Skip to main content
Bounty Awarded with 500 reputation awarded by CommunityBot
Previous version was wrong; --theirs is the branch being merged IN, not the one being merged INTO.
Source Link
mipadi
  • 413.7k
  • 91
  • 538
  • 488

git checkout accepts an --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging intoin, then you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

Toto use that version of the file. Likewise, if you know you want your version (not the one being merged intoin) you can use:

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts an --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging into, then you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

To use that version of the file. Likewise, if you know you want your version (not the one being merged into) you can use:

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts an --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt 
Tried to improve clarity and flow of words
Source Link
AncientSwordRage
  • 7.3k
  • 21
  • 100
  • 196

git checkout accepts aan --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging into, then you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

toTo use that version of the file. Likewise, if you know you want your version (not the one being merged ininto) you can use:

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts a --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts an --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging into, then you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

To use that version of the file. Likewise, if you know you want your version (not the one being merged into) you can use:

$ git checkout --ours -- path/to/conflicted-file.txt 
Improve wording
Source Link
mipadi
  • 413.7k
  • 91
  • 538
  • 488

git checkout accepts a --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts a --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt 

git checkout accepts a --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt 

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt 
Not sure if it was appropriate to so substantially update the answer, so rolling back my previous edit.
Source Link
user456814
user456814
Loading
Added documentation quote and link.
Source Link
user456814
user456814
Loading
Source Link
mipadi
  • 413.7k
  • 91
  • 538
  • 488
Loading