Skip to main content
2 of 4
added 222 characters in body
Ayan
  • 8.6k
  • 4
  • 48
  • 52

To squash the last 10 commits into 1 single commit:

git reset --soft HEAD~10 && git commit -m "squashed commit"

If you also want to update the remote branch with the squashed commit:

git push -f

If your are using the above approach to simplify resolving merge conflicts, then I would rather suggest the following approach:

From your current branch, just do

git pull --rebase origin master

This will rebase your branch against master, and conflicts may come max once(instead of multiple times) since all your commits are put on top of master.

Ayan
  • 8.6k
  • 4
  • 48
  • 52