Skip to content

follow-up: docs/examples/claude-code-hooks/guard-git.sh has drifted far from .claude/hooks/guard-git.sh #2105

Description

@carlos-alm

Noticed while working on PR #2100 (fix/guard-git-mergehead-skip).

Context: docs/examples/claude-code-hooks/guard-git.sh is meant to be an example copy of .claude/hooks/guard-git.sh, but it has drifted significantly out of sync — missing the -C worktree detection (detect_work_dir), branch-name validation, AI-attribution blocking in commit messages, and now the MERGE_HEAD merge-commit bypass added in PR #2100. A diff between the two files shows the example is missing most of the current hook's logic.

Why out of scope for #2100: the drift predates this PR by many prior PRs/features; fixing it is a separate, standalone doc-sync concern, not something introduced or required by the MERGE_HEAD fix.

Suggested fix: either resync docs/examples/claude-code-hooks/guard-git.sh with the current .claude/hooks/guard-git.sh, or replace the static copy with a build/CI step (or a note) that keeps the example in sync automatically so this doesn't keep drifting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upDeferred work from PR reviews that needs tracking

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions