git show commit 无法比较
我希望在通过 git show 查看时在 Beyond Compare 或任何其他单独的 diff 工具中看到特定的提交。我尝试查看 git show/difftool/config 的帮助,但找不到任何内容。有谁知道如何做到这一点?
我查看了 Git Diff 与 Beyond Compare 并为 配置了 Beyond Compare git difftool
但我也想将它用作 git show
中的工具
I would like to see a specific commit in Beyond Compare or any other separate diff tool while viewing it via git show
. I tried looking at help of git show/difftool/config but couldn't find anything. Does anyone know how it can be done?
I've looked at Git Diff with Beyond Compare and configured Beyond Compare for git difftool
but I also want to use it as tool from git show
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我设法使用 git difftool 来查看我通常通过 git show 看到的提交。
git show $commit
转换为git difftool $commit^ $commit
。上面的命令显示了提交的父级 ($commit^) 和提交之间的差异。这一切当然是在用difftool配置Beyond Compare之后。
I managed to use
git difftool
to see commits that I normally used to see viagit show
.git show $commit
translates togit difftool $commit^ $commit
.The above command shows difference between commit's parent ($commit^) and commit. All this is of course after configuring Beyond Compare with difftool.
您还可以创建一个别名“showtool”来包装对 git difftool 的调用:
.. 然后您可以执行:
.. 或只是
.. 作为 git difftool 81e945b~1 81e945b 的快捷方式 使用配置的 difftool 显示在
81e945b
中引入的更改,或者在第二种情况下使用git difftool HEAD~1 HEAD
You can also create an alias "showtool" to wrap the call to
git difftool
:.. then you can execute:
.. or just
.. as a shortcut for
git difftool 81e945b~1 81e945b
to show the changes introduced in81e945b
using the configured difftool, or in the second casegit difftool HEAD~1 HEAD
一旦你设置了 diff 工具,比如很棒的 p4merge,你就可以做到这一点:
工作起来就像一个魅力。
同样,如果你想查看之前的提交,你可以这样做:
Once you have a diff tool set up, like the awesome p4merge, you can do this:
Works like a charm.
Similarly if you want to see the commit before that, you can do:
这对我很有用,可以显示上次提交的差异
对于其他提交,您可以将
HEAD
替换为提交哈希,例如:This worked for me nicely, to show the diff of the last commit
For other commits you can replace
HEAD
with commit hash eg:我认为 git show 是基于 GIT_PAGER 变量中设置的工具。我不使用Beyond Compare,但我认为您可以尝试这样的操作:
也许您应该使用一些允许 bc3 处理输入的附加参数来填充 GIT_PAGER 变量。
有更合适的方法来持久化寻呼机。 这个问题可以为您提供有关如何操作的更多提示。
I think that git show is based on the tool set in the GIT_PAGER variable. I don't use Beyond Compare but i think that you can try something like this:
Maybe you should fill the GIT_PAGER variable with some additional parameter that allows bc3 process the input.
There are more suitable ways to persist the pager. This question can give you more tips about how to do it.
基于@javabrett的回答,我创建了
https://github.com/albfan/git-showtool
支持类似命令
Based on @javabrett answer I have created
https://github.com/albfan/git-showtool
to support commands like