Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Talento90/93667d2c314a2e6c781ea493299eae37 to your computer and use it in GitHub Desktop.
Save Talento90/93667d2c314a2e6c781ea493299eae37 to your computer and use it in GitHub Desktop.
Git Merge Squash
# Commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
# Optional cleanup:
git branch -D mybranchname_unsquashed
# If squashing already-pushed commits...
git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment