如何配置Diffmerge的提示



目前我有这个gitconfig:

[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = diffmerge "$LOCAL" "$REMOTE"
[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    cmd = "diffmerge --merge --result="$MERGED" "$LOCAL" "$(if test -f "$BASE"; then echo "$BASE"; else echo "$LOCAL"; fi)" "$REMOTE""
    trustExitCode = true
[alias]
  df = difftool

每次我通过git difftool somefile启动差异。

Hit return to launch 'diffmerge':

我该如何设置此提示,因此,如果我键入" y",它将打开文件,如果" n"会跳过它?

这有点黑客,但是您可以做:

[alias]
    df = difftool -y
[difftool "diffmerge"]
    cmd = sh -c 'read -p "Type Y to launch diffmerge:" r && 
        test $r = Y 
        && diffmerge "$LOCAL" "$REMOTE"'

假设您的read接受-p。如果没有,请执行标准操作:

cmd = sh -c 'printf "Type Y to launch diffmerge: " && read r && test $r = Y 
            && diffmerge "$LOCAL" "$REMOTE"'

相关内容

  • 没有找到相关文章

最新更新