Git Hooks as Developer Workflow Automation: Beyond Linting
Git hooks can do more than run ESLint. Learn how post-commit and pre-push hooks enable automatic prompt capture, secret scanning, and profile syncing.
Most developers know git hooks as "the thing that runs ESLint before commit." But git hooks are a powerful automation layer that can transform your development workflow. Here is what is possible.
How Git Hooks Work
Git hooks are scripts that run at specific points in the git workflow. They live in .git/hooks/ and execute automatically. The most useful hooks: pre-commit (before commit is created), post-commit (after commit is created), pre-push (before push to remote), and post-merge (after pull/merge).
Beyond Linting
Pre-commit: Run type checking, format code, validate commit messages, check for secrets. Post-commit: Capture AI prompts, update local analytics, trigger notifications. Pre-push: Sync data to remote services, run integration tests, validate branch policies. Post-merge: Update dependencies, regenerate types, clear caches.
How Qmmit Uses Hooks
Qmmit installs two hooks. The post-commit hook fires after every git commit. It reads the commit SHA, message, and changed files, then queries your local AI tool session files for recent prompts. It runs the matching algorithm to link prompts to the commit and stores the results locally.
The pre-push hook fires before git push. It syncs all unpushed prompt-commit links to your Qmmit profile. Before syncing, it runs auto-redaction to catch any secrets that might be in prompt text.
Installing Custom Hooks
Git hooks are just executable scripts. Create a file at .git/hooks/post-commit (no extension), make it executable (chmod +x), and it runs after every commit. For team-wide hooks, use tools like Husky or lefthook that store hooks in the repository.
The Key Insight
Git hooks are the only automation layer that runs on every developer machine, on every commit, without requiring any cloud infrastructure. This makes them perfect for local-first tools like Qmmit — you get automatic behavior without sending data anywhere.
Start tracking your AI prompts
One command. Zero workflow changes. Works with 7 AI tools.