When rebasing interactively with git, often we need to squash a sequence of commits in series, i.e. change a set of commits from this:
pick f7f3f6d changed my name a bit pick 310154e updated README formatting and added blame pick a5f4a0d added cat-file
pick f7f3f6d changed my name a bit squash 310154e updated README formatting and added blame squash a5f4a0d added cat-file
When you need to change a lot of commits from squash to pick it's a bit tiresome to change them one by one - so, if you're using Vim, it's a lot easier to instead:
- place the cursor at the start of the line with the first commit you want to squash
- enter visual block mode (CTRL-V)
- select all the rows you wish squash
- hit 'c' and type 'squash' to replace the 'pick' command
- press ESC to apply that change to all the selected rows.
Your fingers will thank you for it!