b7d0a44guide1 min read
Interactive rebase without fear
Squash, reorder, and reword commits before review, with a safety net in place.
A clean history is a gift to reviewers. Interactive rebase lets you shape a branch into a sequence of commits that each make sense on their own.
Set a safety net
git branch backup/$(git branch --show-current)Rewrite the branch
git rebase -i --autosquash mainpickkeeps a commit as is.rewordkeeps the change and edits the message.fixupfolds a commit into the one above it and drops its message.- Reorder lines to reorder commits.
Commit small fixes with git commit --fixup <ref> as you go, and --autosquash will line them up for you.