AI engineering glossary · Command line Git

What is pre-commit hook?

Pre-commit hook (also called Git hook): A script that Git runs automatically before finishing a commit, and aborts the commit if it fails. Teams use it to run formatters, linters or secret scanners so problems are caught before code is shared.

Level: advancedTopic: Command line Git

Pre-commit hook: an example

A hook in .git/hooks/pre-commit runs a formatter and blocks the commit if a file would change.

Related terms

More Command line Git terms

Where you learn it

Pre-commit hook is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.