Sometimes you will have a pull request that is full of merge commits mixed with regular commits. These branches are a little tricky to squash. I’m here going to show a trick that I sometimes use.
Stand in your pull request branch and run:
git reset --soft origin/master
This resets us back to master but keeps all our changes in staged, ready for us to commit in to one new commit:
git commit -m"My one commit message for all changes"
After this we need to replace all the commits in our pull request with the new one we have in our local
git push -f
We should now have only one commit in our pull request
Tested on Git v2.24.3 and OSX 10.15.6
0 Comments.