目前我有这个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..somefile启动difftool,我得到提示:
Hit return to launch 'diffmerge':
如何设置此提示,如果我输入“Y”,它会打开文件,如果“N”则会跳过它?
答案 0 :(得分:0)
这有点像黑客,但你可以这样做:
[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\"'