Created
July 2, 2019 14:35
-
-
Save Talento90/93667d2c314a2e6c781ea493299eae37 to your computer and use it in GitHub Desktop.
Git Merge Squash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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