commit-fixuplisted
Install: claude install-skill 2ykwang/agent-skills
# commit-fixup
Absorb uncommitted changes into the existing commit each one should have been part of, leaving clean history.
Four stages: safety checks → mapping → scope confirmation → execution and verification.
This rewrites history, so don't skip any stage's checks.
## 1. Safety checks
```bash
git status --short # uncommitted changes
git merge-base HEAD origin/<default-branch> # establish base (use the repo's default branch)
git log --oneline <base>..HEAD # commits in scope
git branch -vv # upstream and push state
git log --merges --oneline <base>..HEAD # merge commits in range
git --version
```
Tell the user before proceeding if any of these hit:
- **Branch already pushed → stop and ask.** Rebasing means a force-push afterwards, and only the user
makes that call. Never run a force-push on your own.
- **Merge commits in range → stop.** The rebase flattens the merge structure.
- **git older than 2.44 → don't proceed.** That version lacks the non-interactive `git rebase --autosquash`
this skill relies on. Say the git version is too old to automate this safely and point at an upgrade
(macOS: `brew upgrade git`, Ubuntu: `apt upgrade git`).
- Untracked files are not absorption targets. Leave them alone.
## 2. Mapping: find the target commit for each changed file
For each modified file, find the commit in branch range that **touched it last**:
```bash
git log --oneline <base>..HEAD -- <file> | head -1
```