如何在合并工具期间选择整个 REMOTE 文件?

JSS*_*all 7 git vim merge vimdiff mergetool

我正在使用 CLI 合并工具vimdiff,而不是逐行输入:diffg RE每个更改来选择远程版本,有没有办法可以将整个文件的远程版本作为目标合并?

rkt*_*kta 6

简短的回答:

使用:%diffget得到所有块。


解释:

diffget需要 - 就像大多数 vim 命令一样 - 一个范围。引用 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.
Run Code Online (Sandbox Code Playgroud)

%当用作范围“等于 1,$(整个文件)”时,请参阅:help :%.