Hi, I'm Chris

This blog is about programming, linux and other stuff.
Please don’t hesitate to contact me if you have any questions or suggestions for improvements!

basic vimdiff commands for git mergetool

Today I had to resolve a git merge conflict with vimdiff and it took me quite a while to find the right commands for this task. Fortunately, I discovered this post which you should read, if you want to get started with vimdiff and git. The most basic command to get a merge conflict done with vimdiff are:

crtl + w, {h,j,k,l} to move from one window to another

diffg (short for diffget) to copy stuff from the {REMOTE, BASE, LOCAL} pane to the active pane.

:diffg RE  " get from REMOTE
:diffg BA  " get from BASE
:diffg LO  " get from LOCAL

]c move to the next conflict

[c move to the previous conflict

:wqa to save and close all open panes in vim

Additionally, the following options are quiet useful:

git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
comments powered by Disqus