Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select the entire REMOTE file during mergetool?

I'm using CLI mergetool vimdiff and rather than going line by line and typing :diffg RE for every change to select the REMOTE version, is there a way I can just have the REMOTE version of the entire file as the target merge?

like image 424
sphere Avatar asked Mar 30 '19 08:03

sphere


1 Answers

Short answer:

Use :%diffget to get all chunks.


Explanation:

diffget takes - as most vim commands - a range. To quote vimhelp:

                                                        :diffg :diffget
:[range]diffg[et] [bufspec]
                Modify the current buffer to undo difference with another
                buffer.  [...]
                See below for [range].

[...]

When no [range] is given, the diff at the cursor position or just above it is
affected.  When [range] is used, Vim tries to only put or get the specified
lines.

% when used as a range is "equal to 1,$ (the entire file)", see :help :%.

like image 126
rkta Avatar answered Sep 20 '22 04:09

rkta