AI agents like GitHub Copilot, Claude Code, and Codex automatically append
Co-authored-by trailers to every commit. This global commit-msg hook
silently removes them from all repos on your machine.
# 1. Create the global hooks directory
mkdir -p ~/.config/git/hooks
# 2. Save the hook (contents in commit-msg file in this gist)
curl -o ~/.config/git/hooks/commit-msg \
https://gist.githubusercontent.com/muthuishere/21080f394fcdce568241c289ca97a318/raw/commit-msg
# 3. Make it executable
chmod +x ~/.config/git/hooks/commit-msg
# 4. Tell git to use it globally
git config --global core.hooksPath ~/.config/git/hooksStrips any line matching Co-authored-by: from the commit message before the commit is recorded. Works with all git clients and AI agents.
git config --global --unset core.hooksPath