1

I want to use vim (fugitive possibly) to merge my conflicts, but I hate the automerged conflict markers. I'm looking for something like

|-------------------------------|
|         |          |          |
| LOCAL   | HEAD     |   REMOTE |
|         |          |          |
|-------------------------------|
|                               |
|    clean head to merge        |
|       changes into            |
|-------------------------------|

How do I set this up?

1

2 Answers 2

1

To always turn off conflict markers, you can configure the binary merge algorithm (source):

$ git config merge.default binary

Alternatively, the index has all different versions; just override your working copy with what you want:

$ git checkout --ours <filename>
$ git checkout --theirs <filename>
$ git checkout-index -f --stage=1 <filename>    # for the base

(With Fugitive you can do this directly from within Vim.)

0

I use Fugitive. The amazing vim cast on resolving merge conflicts with vimdiff + Fugitive is what I use repeatedly every time I forget how to do this.

  1. You open up a conflicted file and type :Gvdiff (this gives you a vertical split as you want)
  2. You use :diffput (or just dp) to push code from local/remote windows to HEAD
  3. Once you're happy with the changes type :Gwrite and it will close the diff window and add the file to the Git index ready for the commit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .