Guided Notes

Advanced Git & Best Practices

Hooks, CI/CD, submodules, signed commits, advanced remotes, and team best practices.

Git hooks

Slide 1 / 5

Hooks are scripts Git runs automatically at certain moments. They live in .git/hooks/:

β€’ pre-commit β€” before a commit is created: run a linter or formatter, block debug code. β€’ commit-msg β€” check the message format. β€’ pre-push β€” run tests before pushing.

A hook that exits with a non-zero status cancels the action. Hooks aren't shared through clones, so teams use tools like Husky or pre-commit to install them for everyone.

← .gitignore, .gitattributes & LFS