Created
February 28, 2012 01:10
-
-
Save minism/1928314 to your computer and use it in GitHub Desktop.
Git merge theirs
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
# in case branchA is not our current branch | |
git checkout branchA | |
# make merge commit but without conflicts!! | |
# the contents of 'ours' will be discarded later | |
git merge -s ours branchB | |
# make temporary branch to merged commit | |
git branch branchTEMP | |
# get contents of working tree and index to the one of branchB | |
git reset --hard branchB | |
# reset to our merged commit but | |
# keep contents of working tree and index | |
git reset --soft branchTEMP | |
# change the contents of the merged commit | |
# with the contents of branchB | |
git commit --amend | |
# get rid off our temporary branch | |
git branch -D branchTEMP | |
# verify that the merge commit contains only contents of branchB | |
git diff HEAD branchB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment