← Back to catalog
HookGit↓ 313

Auto Git Add

Stages every file the agent edits or creates in git.

Installation
npx claude-code-templates@latest --hook post-tool/git-add-changes --yes

This hook fires on the PostToolUse event, right after an Edit or Write operation. It acts on the file that was just changed.

It runs git add on the file, leaving it ready for the next commit. Error suppression is built in, so the hook does not fail in directories that are not git repositories.

When to use

  • When you want to speed up the commit flow without running git add every time.
  • When you make frequent edits and want everything already staged.

How to use

After installing, it stages files automatically on every edit or creation. Just commit when you are ready.