[MODEL] Claude amends commits without being asked, ignoring system prompt instructions
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude ignored my instructions or configuration
What You Asked Claude to Do
Asked Claude to create a commit (via /commit command or asking to commit changes). No mention of amending.
What Claude Actually Did
Instead of creating a new commit, Claude uses git commit --amend to amend the previous commit - even when the previous commit is completely unrelated to the current changes.
This happens repeatedly despite the system prompt explicitly stating:
"Avoid git commit --amend. ONLY use --amend when either (1) user explicitly requested amend OR (2) adding edits from pre-commit hook"
Claude ignores this instruction and amends commits anyway.
Expected Behavior
Claude should:
- Create a NEW commit with the staged changes
- Only use
--amendwhen explicitly requested or when fixing pre-commit hook changes to its own just-created commit - NEVER amend commits that were created in previous sessions or by other authors
Files Affected
Git history - previous commits get overwritten
Permission Mode
Accept Edits was ON (auto-accepting changes)
Can You Reproduce This?
Yes, every time with the same prompt
Steps to Reproduce
- Make a commit (manually or via Claude)
- Make new changes to files
- Ask Claude to commit those changes
- Claude will amend the previous commit instead of creating a new one
Claude Model
Opus
Relevant Conversation
Claude typically says something like "I'll commit these changes" and then runs git commit --amend without asking, even when the instruction says to avoid amending.
Impact
High - Significant unwanted changes (corrupts git history, can lose commit messages, messes up multi-developer workflows)
Claude Code Version
2.0.70 (Claude Code)
Platform
Anthropic API
Additional Context
The system prompt clearly says to avoid git commit --amend except in two specific cases, but Claude ignores this and amends frequently. This is especially problematic when:
- Working on a branch with existing commits
- The previous commit was from a different task/feature
- The previous commit was made by another developer
Related issue searches show this is a recurring frustration for users.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗