Last Updated: February 25, 2016
·
27.42K
· xlphs

git merge --squash for merging without commit history

Say you created a new branch to work on issue #10:

git checkout -b iss10

Now you've made some commits and ready to apply them to master, but you want them to be all in one commit.

git checkout master
git merge --squash iss10
git commit -m "Merged iss10"

In case you need to merge iss10 into master again in the future, right now you should update iss10 to base off master:

git branch -D iss10
git checkout -b iss10
git push -f origin iss10

That's it.