Ever been asked to rebase your messy commits into a nice one? Are you doing a lot of
git commit -am "removed whitespace"? You can easily squash those commits into a single message without entering
git rebase. Here's how:
# doing some work.... git commit -am "feature - add widget confabulator" # oops left in a `console.log`... gotta remove it and make a commit git commit -am "removed console log" # oops I've indented with tabs... gotta fix that git commit -am "tabs -> spaces"
All we want now, is one nice commit saying "feature - add widget confabulator." You can enter
git rebase -i and mark the extra commits for
fixup, but the easier way is to soft-reset your tree to the first commit in your workflow, stage what you need, and just make the commit again:
git reset --soft HEAD~3 # 3 commits back git commit -am "feature - add widget confabulator"
Now all my console.log removal and indentation fix is a part of one nice commit.