Search code examples
gitmergetool

Resolve conflicts automatically with git-mergetool


Now i resolve few conflicts, and want retain only remote state.

If i try change my option: git merge --strategy-option theirs
I have getting, error: 'merge' is not possible because you have unmerged files.

Of course, i can cancel my changes (for use command above), but then i will lose my changes.

Now, me offering run vimdiff: {local}: modified file {remote}: modified file Hit return to start merge resolution tool (vimdiff):

How i can retain only remote state. If file not exist - it easy (offer push the button).

Thanks.


Solution

  • Use the git checkout command to set the working tree to match the remote stage (3):

    git checkout -3 PATHS...
    

    Or the local stage (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.