Created
September 25, 2018 18:24
-
-
Save xnull/7e0b57cf2fe4e40b0ebc6605597642ef to your computer and use it in GitHub Desktop.
This file contains 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
https://gist.github.com/n00neimp0rtant/9515611 |
git push --force
<- If git complains about fatal: The current branch $BRANCHNAME has no upstream branch. Do git push --set-upstream origin $BRANCHNAME
.
Instead do: git push --set-upstream origin $BRANCHNAME --force
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
within current branch, squashes all commits that are ahead of master down into one
useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
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, not recommended if you want to keep the unsquashed history around for a bit longer
git branch -D mybranchname_unsquashed
if squashing already-pushed commits...
git push --force