| name | git-amend |
| description | MANDATORY: Use instead of `git commit --amend` - verifies HEAD and push status first |
Git Amend Skill
Purpose: Safely amend the most recent commit with proper verification checks.
Safety Rules
Only Amend When ALL Conditions Are Met
- HEAD commit was created by you in this session
- Commit has NOT been pushed to remote
- You intend to modify HEAD (not an earlier commit)
git status
Quick Workflow
git log --oneline -1
git status
git add <files>
git commit --amend
git commit --amend -m "New message"
git commit --amend --no-edit
Common Use Cases
Fix a typo in the last commit
vim file.txt
git add file.txt
git commit --amend --no-edit
Add forgotten file to last commit
git add forgotten-file.txt
git commit --amend --no-edit
Change commit message only
git commit --amend -m "Better commit message"
Dangerous Situations
git push origin main
git commit --amend
git pull
git commit --amend
git commit --amend
git push --force-with-lease
Amending Earlier Commits
To modify a commit that's NOT at HEAD, use interactive rebase:
git rebase -i <commit>^
git add <files>
git commit --amend
git rebase --continue
Error Recovery
git reflog
git reset --hard HEAD@{1}
Success Criteria