We can bring up the mergetool
:git
$ git mergetool
Then it will bring up the different versions of the file in different Vim splits
panels.github
+--------------------------------+ | LOCAL | BASE | REMOTE | +--------------------------------+ | MERGED | +--------------------------------+
The top left split panel is the LOCAL
, top middle split is BASE
and top right split is REMOTE
. The bottom split refers to theMERGED
version. You can find this info in the bottom bar of each split (I have put 3 yellow rectangles to highlight that info).ui
As you can see form the below image, my Vim
has highlighted the differences in red for me. this
Now if your terminal has any GUI capability and you have compiled Vim
correctly with GUI support, you can use your mouse to click on the bottom split to edit it. Or if you are a Vim
ninja, you can use the keyboard shortcut to move to different splits.3d
Ctrl w + h # move to the split on the left Ctrl w + j # move to the split below Ctrl w + k # move to the split on top Ctrl w + l # move to the split on the right
You can either incorporate the changes by manually editing the MERGED
split, or use Vim
shortcuts pull from one of theLOCAL
, BASE
ad REMOTE
versions.code
:diffg RE # get from REMOTE :diffg BA # get from BASE :diffg LO # get from LOCAL
save the changes then quit with :wqa
to close all the splits. Remember to commit the merge.orm
$ git commit -am 'merged from several branches'