Fixup Commit Skill
Create a fixup for the last commit (small correction that should be part of the previous commit).
Context
- •Current git status: !
git status - •Staged changes: !
git diff --cached - •Unstaged changes: !
git diff - •Last commit: !
git log -1 --oneline
Workflow
- •
Safety checks
- •Verify the last commit has NOT been pushed to remote
- •If the branch shows "ahead of origin", it's safe to proceed
- •If already pushed, STOP and warn the user (amending would require force push)
- •
Stage changes
- •If nothing is staged, stage all changes
- •If changes are staged, use those
- •
Create fixup commit and squash
Option A - Using git commit --amend (simpler):
bashgit add -A # if needed git commit --amend --no-edit
Option B - Using fixup workflow (if you want to review):
bashgit add -A # if needed git commit --fixup HEAD git rebase -i --autosquash HEAD~2
- •
Verify success
- •Run git log to show the amended commit
- •Run git status to confirm clean state
Important Notes
- •Do NOT use this if the last commit has been pushed
- •Do NOT add any new commit message content
- •Do NOT push to remote