Five messy photos on the rapikan ribbon: write the rebase -i todo (pick, reword, squash, fixup, drop, order) and watch Mr. Harun’s darkroom reprint line by…
Why it matters
Before sharing a branch, tidying its history makes reviews and git log far easier to read. Rebase -i is the tool, but the direction a squash folds, the message a fixup drops and an order that can clash confuse people until they watch it run.
The key idea
The todo runs top to bottom, photo by photo
Common mistakes
rebase -i on history already pushed A rebase -i makes new commits, so anyone who fetched the old ones has a different history. Tidy before you share; after that, add new commits or git revert.
Does squash fold into the commit above or below? Into the line above it in the todo, the older commit. A squash on the top line has nowhere to fold, so git refuses it.
A wrong todo halfway through While the rebase is unfinished, git rebase --abort puts the branch back exactly as it was. Once it is done, git reflog shows the old tip: git reset --hard ORIG_HEAD.
Try it in this playground
Fold with fixup The photo goes into the line above, its message dropped.
Fold with squash Both messages are combined.
Throw a photo away with drop Its change vanishes from the photos after it too.
Rename with reword The same content, a new message, a new number.