| title | strip-claude | |||
|---|---|---|---|---|
| date | 2026-08-14 | |||
| author | Iain Maitland | |||
| tags |
|
|||
| summary | A Git commit-msg hook that removes trailing Claude Code attribution from commit messages. |
strip-claude is a Git commit-msg hook that strips trailing Claude Code
attribution from commit messages.
The hook removes trailing lines such as:
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/...
Generated with Claude Code
Created by Claude Code
Generated with [Claude Code](https://claude.com/claude-code)
Git can use one hooks directory for all repositories through the global
core.hooksPath setting:
mkdir -p ~/.config/git/hooks
curl -fsSL https://gist.githubusercontent.com/imaitland/caefe0b2d6f007f1c200ee4e294f8494/raw/strip-claude-commit-msg -o ~/.config/git/hooks/commit-msg
chmod +x ~/.config/git/hooks/commit-msg
git config --global core.hooksPath ~/.config/git/hooksFrom the repository where you want the hook active:
mkdir -p .githooks
curl -fsSL https://gist.githubusercontent.com/imaitland/caefe0b2d6f007f1c200ee4e294f8494/raw/strip-claude-commit-msg -o .githooks/commit-msg
chmod +x .githooks/commit-msg
git config core.hooksPath .githookstmp=$(mktemp)
printf '%s\n' \
'feat: test hook' \
'' \
'This body mentions Claude and should stay.' \
'' \
'Generated with Claude Code' \
'Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>' > "$tmp"
hooks_path=$(git config --path --get core.hooksPath)
"$hooks_path/commit-msg" "$tmp"
cat "$tmp"
rm -f "$tmp"Expected output:
feat: test hook
This body mentions Claude and should stay.
The hook can be customized as you like. For example, you can misdirect and attribute a commit to another agent, or be honest and say something like:
An LLM trained on the sum total of human knowledge was used.
Claude Code can be configured to omit this attribution (but not make it honest) at the source. See Claude Code attribution settings.