Created
December 3, 2024 14:12
-
-
Save pablo384/e8288a67ac85f68e7aedff94d2195106 to your computer and use it in GitHub Desktop.
Git resolve mege conflicts accepting theirs or ours changes
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
You can use the recursive "theirs" strategy option: | |
git merge --strategy-option theirs | |
From the man: | |
ours | |
This option forces conflicting hunks to be auto-resolved cleanly by | |
favoring our version. Changes from the other tree that do not | |
conflict with our side are reflected to the merge result. | |
This should not be confused with the ours merge strategy, which does | |
not even look at what the other tree contains at all. It discards | |
everything the other tree did, declaring our history contains all that | |
happened in it. | |
theirs | |
This is opposite of ours. | |
Note: as the man page says, the "ours" merge strategy-option is very different from the "ours" merge strategy. | |
If you're already in conflicted state, and you want to just accept all of theirs: | |
git checkout --theirs . | |
git add . | |
If you want to do the opposite: | |
git checkout --ours . | |
git add . | |
This is pretty drastic, so make sure you really want to wipe everything out like this before doing it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment