带有 DiffMerge 设置的 git 来模仿带有 diffmerge 的 Mercurials 设置
我想知道是否有一种方法可以设置 git 和 diffmerge,以便当您执行以下命令时: git difftool diffmerge 会弹出并显示所有已修改文件的文件列表,而不是循环浏览通过命令行?
我想这一定是对 ~/.gitconfig 文件的一些设置。这是我当前的 ~/.gitconfig:
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE
[mergetool]
keepBackup = false
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/diffmerge $LOCAL $REMOTE
请参阅下面的 Mercurials (HG) 呈现 DiffMerge 的方式。
I'm wondering if there is a way to setup git and diffmerge so that when you execute the following command: git difftool
diffmerge pops up and shows you a file listing of all the modified files instead of cycling through them via the command-line?
I'm thinking it must be some setting the ~/.gitconfig file. Here is my current ~/.gitconfig:
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE
[mergetool]
keepBackup = false
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = /Applications/DiffMerge.app/Contents/MacOS/diffmerge $LOCAL $REMOTE
See below for Mercurials (HG) way of presenting DiffMerge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您的
.gitconfig
中应该包含以下几行:You should have the following lines in your
.gitconfig
:Git 在其默认设置中不提供目录差异。请参阅这个相关的SO问题:
另外,请参阅 GitHub 上的 git diffall 项目,该项目实现了此功能作为附加脚本。
Git does not provide directory diffs in its default setup. See this related SO question:
Also, see the git diffall project on GitHub which implements this feature as an add-on script.
请注意,您现在可以 (git 1.7.11) diff 目录(即显示在打开 difftool 之前要比较的所有文件)
请参阅“
git difftool
进行目录比较?”换句话说,git 现在确实“固有地处理文件夹差异”。
Note that you now can (git 1.7.11) diff directories (ie display all the files to be compared, before opening the difftool)
See "
git difftool
to give directory compare?"In other words, git now does "inherently handle folder diffs."
请查看这里的问题和答案,了解有关使用 diffmerge 设置 git 的详细信息:
OS X 上的 git + DiffMerge 问题
Take a look at the question and answer here for details regarding setting up git with diffmerge:
Problem with git + DiffMerge on OS X