Automatically resolve conflicts with git -mergetool

Now I resolve several conflicts and want to keep only the remote state.

If I try to change my option: git merge --strategy-option theirs
I have an error: "merge" is impossible because you have unrelated files.

Of course, I can undo my changes (to use the command above), but then I will lose my changes.

Now I suggest running vimdiff: {local}: the modified file {remote}: the modified file Click "Return" to start the merge permission tool (vimdiff):

How can I save only the remote state. If the file does not exist, simply (suggest pressing a button).

Thanks.

0
source share
1 answer

Use the git checkout command to set up the working tree according to the remote stage (3):

 git checkout -3 PATHS... 

Or local scene (2):

 git checkout -2 PATHS... 

Then add the files and commit to complete the merge.

Use git checkout -h if you forget which one is 2 and 3.

0
source

Source: https://habr.com/ru/post/1012786/


All Articles