Created
January 28, 2021 10:53
-
-
Save ahamed/9020fce5b70b40214d1f5fa89a637ef6 to your computer and use it in GitHub Desktop.
Force push a branch to another branch without keeping the history or matches.
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
| # Checkout to the reseting branch | |
| #e.g. `git checkout master` | |
| git checkout old_branch | |
| # reset hard by the new branch's contents | |
| # e.g. `git reset --hard origin/v2.0.0` | |
| git reset --hard new_branch | |
| # force push the contents to the origin | |
| # e.g. `git push origin master --force` | |
| git push origin old_branch --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment