Git hooks automate workflows by running scripts automatically during git events such as commits. For example, a pre-commit hook can run tests before the commit is saved. If tests fail, the hook script exits with a non-zero code, causing git to abort the commit and show an error message. If tests pass, the commit continues normally. This automatic running of scripts helps enforce rules and quality checks without the developer needing to run commands manually. Hooks are stored in the .git/hooks directory and activate on specific git actions, making workflows safer and more consistent.