dan
dan

Reputation: 893

How Can I resolve conflicts with git command line to keep target (visual studio 2019)?

when merging with git there are a lot of conflicts, I just want to Keep target or take source - is there a way to do this from UI or git command line so I can do them for multiple/all files? thank you. Visual studio used to allow us to do with TFVC repos.

enter image description here

Edit: note - that I don't want to use -Xtheirs or -Xours on git command line, because I dont necessarily want all the files in the merge to be auto merged with ours or theirs - I would want to choose which files (or first merge some of the files differently so what's left would either be auto merged as ours or theirs). is there a command or way to do this in UI to do this AFTER the merge command and not part of the merge command so I can first choose different merge for other files.

Upvotes: 2

Views: 2315

Answers (2)

LeGEC
LeGEC

Reputation: 51780

You can use git checkout [--ours|--theirs] on a list of files or directories :

git checkout --ours -- file1
git checkout --theirs -- file2
git add file1 file2

# you can specify any number of patterns :
git checkout --ours -- file1 file2 dir3/ that/dir/too/

Upvotes: 3

jobayersozib
jobayersozib

Reputation: 409

using -Xours or -Xtheirs parameter in merge command you solve this issue

git merge -Xours merging_branch_name

OR

git merge -Xtheirs merging_branch_name

for details follow this link

Upvotes: 2

Related Questions