我已经设置了我的git使用 P4Merge 作为 diff 工具,如上所述here http://progit.org/book/ch7-1.html. So, git diff
将触发 P4Merge。
然而,有时我发现使用 UNIXdiff
更快、更高效(因为不涉及 GUI)。如何设置 git 以便可以轻松选择要触发的 diff 工具?这可能吗?例如:
$ git diff # to trigger P4Merge
$ git difftool # to trigger UNIX diff
My git config --list
:
code.editor=vi
merge.tool=p4merge
mergetool.extMerge.cmd=extMerge $BASE $LOCAL $REMOTE $MERGED
mergetool.extMerge.trustexitcode=false
diff.external=extDiff
mergetool.prompt=false
mergetool.keepbackup=false
mergetool.p4merge.path=/usr/local/bin/p4merge
您只需明确指出要使用哪个 difftool 即可。我的里面有这个~/.gitconfig
:
[diff]
tool = vimdiff
[difftool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "/c/Users/rkasten/Google\\ Drive/Apps/WinMerge/WinMergeU.exe" -u -e $LOCAL $REMOTE
然后我有以下别名设置:
alias gdt='git difftool'
alias gdtw='git difftool --tool=winmerge'
使用 masukomi 的示例,您只需将以下内容添加到 gitconfig 中:
[difftool "Kaleidoscope"]
cmd = ksdiff --whatevs
And use alias gdtk='git difftool --tool=Kaleidoscope'
使用万花筒。
所有这些都在 git 2.7 中有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)