Last active
May 3, 2018 04:19
-
-
Save DharmendraRathor/df22b03b16b8a16d8555a6f60983808f to your computer and use it in GitHub Desktop.
Replace branch with master branch in git
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
You have branch having latest changes “latestBranch” and if you want to override master with latestBranch changes. | |
Use following commands | |
1. Checkout latestBranch. | |
git checkout latestBranch | |
2. Merge latestBranch with master with strategy as ours. Current branch changes will be used in case of conflicts. | |
git merge -s ours master | |
3. Checkout master branch. | |
git checkout master | |
4. Merge master with latestBranch | |
git merge latestBranch | |
5. Push master with latest code. | |
git push (git push origin master) | |
you can also use git force push “git push -f origin master”. Please check branch history before running git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Documentation for git ours strategy : https://git-scm.com/docs/git-merge