Repository navigation
chore: strip Claude attribution from commits via a checked-in commit-msg hook - #83
Merged
Merged
Conversation
…msg hook Vendors the commit-cleaner hook from jacobrakaiFoundation/.github under .githooks/, and adds .claude/settings.json so Claude Code sessions activate it on start and block --no-verify and hooksPath bypasses. Re-includes .claude/settings.json, .claude/hooks/ and .githooks/ in .gitignore; personal Claude state stays untracked. Local contributors run: git config core.hooksPath .githooks
Sets attribution.commit to an empty string and attribution.sessionUrl to false in .claude/settings.json, the supported way to stop Claude Code writing Co-Authored-By and Claude-Session trailers. Works on every machine the project settings load on, without git hook configuration; the commit-msg hook stays as a backstop. The SessionStart command now cds into CLAUDE_PROJECT_DIR first so it works when the session cwd is not the repository.
Keeps repositories that run ruff format --check or black over the whole tree green. No behaviour change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Claude Code adds
Co-Authored-By: ClaudeandClaude-Session:trailers to every commit. This vendors thecommit-cleanerhook fromjacobrakaiFoundation/.githubso those lines are stripped before a commit is recorded, and wires it so Claude Code on the web sessions (fresh clones with no hooks) get it automatically.Changes
.githooks/commit-msg: the hook. Strips Claude attribution lines, keeps humanCo-Authored-Bytrailers, leaves clean messages byte-identical, never blocks a commit..claude/hooks/commit-guard.py+.claude/settings.json: aSessionStarthook setscore.hooksPath=.githooksat the start of every Claude Code session, and aPreToolUseguard refusesgit commit --no-verify/-n,core.hooksPathoverrides, and edits to the hook..gitignore:.claude/was ignored wholesale. Appended exceptions sosettings.jsonandhooks/are tracked while personal state (settings.local.jsonetc.) stays untracked.git config core.hooksPath .githooks.How tested
The hook and guard have a 26-case test suite in
jacobrakaiFoundation/.github(tools/commit-cleaner/test.sh). Same change already merged inbeanstalkanddocassemble.🤖 Generated with Claude Code
https://claude.ai/code/session_01MU3XgW95kXzx2SHkKwPW32
Generated by Claude Code