Squash Commits Before they are Pushed with Interactive Rebase

Chris Achard
InstructorChris Achard

Share this video with your friends

Send Tweet

We have created 3 commits that we want to squash together before we push them to github. We can enter an interactive rebase with:

git rebase -i HEAD~3

and then change pick to squash for the last two commits (we want to squash "down" into the first one).

Then we'll be given the chance to make the commit message for that commit, and once we save the message we'll be left with just a single commit that contains the changes from all three commits.