Sometimes you stuff too much into one commit and want to split it before review.
Workflow:
-
git rebase -i HEAD~3 — mark the target commit as edit.
-
When Git pauses there, undo the commit but keep the changes:
git reset HEAD^
-
Stage and commit in pieces:
git add src/auth.ts
git commit -m "feat: oauth flow"
git add src/auth.test.ts
git commit -m "test: oauth coverage"
-
git rebase --continue finishes the rebase.
Result: what was one commit is now two (or more) with surgical scope. Lets you split a "WIP" commit into reviewable atoms after the fact.