Created
December 22, 2015 17:52
-
-
Save springmeyer/b2cb1b3b0f00fc6268b1 to your computer and use it in GitHub Desktop.
Poor person's git 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
# start in a custom branch | |
git checkout <custom branch> | |
# make sure you have latest master pulled in | |
git pull origin master | |
# then diff out the difference between your branch and master | |
git diff origin/master > my.diff | |
# then delete your local branch | |
git checkout master | |
git branch -D <custom branch> | |
# recreate the branch | |
git branch <custom branch> | |
git checkout <custom branch> | |
# now apply the diff and add as a single commit | |
git apply my.diff | |
git commit -a -m "all changes in one clean commit" | |
# force push now which will overwrite remote branch with new branch with a single commit | |
git push -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, interesting:
should be done from within
<custom branch>
?That's probably where my problems with the Studio Classic PRs (and the latest changes from
master
not showing) originated from.I did do a pull, but from within
master
, not<custom branch>
.