Finding the Real Mixed-Up Commit
Two genuinely unrelated files changed in one real commit — a clear signal it should be two commits, not one.
Pausing Mid-Rebase to Split It
GIT_SEQUENCE_EDITOR="sed -i '3s/^pick/edit/'" git rebase -i HEAD~5
git reset HEAD~1
The real edit verb stops the rebase exactly at that commit; git reset HEAD~1 genuinely un-commits it while leaving every real file change staged and ready to split.
Two Real, Focused Commits
git add dinner.md
git commit -m "Add dinner recipe"
git add breakfast.md
git commit -m "Fix typo in breakfast recipe"
git rebase --continue
Reordering Two Independent Commits
GIT_SEQUENCE_EDITOR="sed -i '1{h;d};2{G}'" git rebase -i HEAD~2
A real, scripted swap of the two todo lines — since dessert and snack touch genuinely different files, the reorder replays cleanly with no real conflict.
A real, honest mistake: while adding the dinner recipe, a small typo fix to breakfast.md got staged and committed right alongside it. One real commit, two genuinely unrelated changes — exactly the kind of thing a careful reviewer would flag.
git rebase -i's edit verb pauses the rebase directly at that commit, with its changes already applied and staged. From there, git reset HEAD~1 genuinely un-commits it — without touching the actual file changes — leaving them staged and ready to be split into two real, focused commits before the rebase continues.
edit (in an interactive rebase)
Pauses the rebase at a specific real commit, with its changes already applied to the working tree. Confirmed directly in this lab: this is the real starting point for amending, inspecting, or splitting that exact commit before continuing.
git reset HEAD~1 (mid-rebase)
Genuinely un-commits the paused commit while leaving its real file changes staged and ready to work with. Confirmed directly in this lab: this is how one real commit becomes two, without losing or redoing any actual change.
Takeaways
- The edit verb pauses an interactive rebase at a specific commit, with its changes already applied
- git reset HEAD~1 mid-rebase un-commits without losing the real staged changes — the real basis for splitting a commit
- Reordering two commits is safe when they touch genuinely different, non-overlapping content
- Every replayed or split commit gets a real, new hash, even when its actual content is unchanged