I actually want to squash around 5-6 commits in a single commit. What is the best option I have in this case?
With the most recent commit checked out, do a soft reset to your desired parent commit. If the commits are linear, The parent of the last N
commits is HEAD~N
. For example, to combine the last five commits:
git reset --soft HEAD~5
Optionally, make sure you've got the right changes with git status
or git diff
.
Then create the new commit:
git commit -m 'five combined commits in one'