justask.dev

Community powered answers to your dev questions

Squash commits

posted: 2019 December 6th

category: git

Edit this post on GitHub.

Back

Before you merge your code its often a good idea to squash your commits. The first step is to find out how many commits have been made

1git rev-list HEAD --count

Once we have the number of commits we can run the following command to squash them

1git rebase -i HEAD~numberOfCommits

Author: Rich Haines