2016-08-31 29 views
1

通常git -c merge.tool=gvimdiff mergetool打开文件由一个被合并的,在批处理模式下:如何使gvimdiff通过git mergetool打开一次在标签页中打开所有文件?

Normal merge conflict for '...': 
    {local}: modified file 
    {remote}: modified file 
4 files to edit 
... seems unchanged. 
Was the merge successful? [y/n] n 
merge of ... failed 
Continue merging other unresolved paths (y/n) ? y 
Normal merge conflict for '...': 
    {local}: modified file 
    {remote}: modified file 
4 files to edit 
modules ... seems unchanged. 
Was the merge successful? [y/n] n 
merge of modules ... failed 
Continue merging other unresolved paths (y/n) ? n 

我如何让它打开所有文件之一,包含四个窗格玻璃装置的每个选项卡(如在gvim -p file1 file2)文件被合并?

+0

相关的difftool:http://stackoverflow.com/questions/1220309/git-difftool-open-all-diff-files-immediately-not-in-serial –

回答

0

git mergetool flow设计用于一次解决一个文件中的冲突。因此,你所要求的不能以一种干净的方式来完成。但是可以创建一个自定义的mergetool,它将在一个gvim窗口中累积来自git mergetool的输入。这个“解决方案”不可避免地要包含的窍门是它必须使流程相信定制的mergetool已成功合并文件,尽管它只是在gvim中打开了该文件。这是必要的,以便git mergetool流程进入下一个文件而不会询问任何问题。因此,如果您退出gvim而未做任何更改,git仍然会认为所有冲突都已解决。

这样一个自定义合并工具的草稿(打开文件在不同GVIM的窗口,而不是标签)如下:

的.gitconfig

[mergetool "mygvimdiff"] 
    cmd=/path/to/mygvimdiff "$MERGED" "$LOCAL" "$BASE" "$REMOTE" 
    trustExitCode=true 

mygvimdiff

#!/bin/bash 

gvim -d -c "wincmd J" "[email protected]" 

# wait till gvim loads the temporary files before 
# the git mergetool script deletes them 
sleep 1 

exit 0 

用法

git mergetool -t mygvimdiff 
+0

也许不如假不成功的合并?据我所试验,mergetool仍然要求下一个文件。 –

+0

@Vi。然后有人必须回答mergetool的确认才能继续 – Leon

相关问题