mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
- Adds two Husky hooks to prevent Claude Code from bad git practices: - \`prepare-commit-msg\`: blocks \`git commit --amend\` (detected via the \`commit\` source argument) - \`pre-commit\`: blocks committing directly to \`main\` - Both hooks detect Claude Code sessions via the \`CLAUDECODE\` environment variable, so regular users are unaffected - Error messages explicitly tell Claude what to do instead
9 lines
279 B
Bash
Executable File
9 lines
279 B
Bash
Executable File
#!/bin/sh
|
|
# Prevent Claude Code from amending commits.
|
|
# The prepare-commit-msg hook receives "commit" as $2 when --amend is used.
|
|
|
|
if [ "$2" = "commit" ] && [ -n "$CLAUDECODE" ]; then
|
|
echo "error: Amending commits is not allowed. Create a new commit instead." >&2
|
|
exit 1
|
|
fi
|