call git rebase with the number of commits to be squashed git rebase --interactive HEAD~2 the list of commits will be displayed pick b76d157 b pick a931ac7 c mark the commits to be squashed in this case squash c into b