在 GUI 中探索 git-diff 输出?

发布于 2024-10-02 17:56:48 字数 232 浏览 5 评论 0原文

是否有程序允许在 GUI 中探索 git-diff 命令的输出?

我正在寻找类似于 SmartGit 如何显示工作副本和 HEAD 之间差异的视图的东西。其中显示与 HEAD 不同的每个文件,并显示焦点文件的差异。

我不确定是否可以让 SmartGit 显示“git diff”命令的输出。

替代文本

Is there program that allows output of a git-diff command to be explored in a GUI?

What i am looking for is something similar to the how SmartGit displays its view of the differences between the working copy and the HEAD. Where each of the files that are different to the HEAD are displayed and the diff for the focused file is displayed.

I am not sure if it is possible to make SmartGit display the output of a "git diff" command.

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

誰認得朕 2024-10-09 17:56:49

IntelliJ、GoLand、PyCharm 等 JetBrains 产品都内置了 diff 工具。如果您想在当前提交与先前提交之间进行比较,只需右键单击代码行左侧并打开“注释”,然后单击任何注释即可查看所有文件的差异。

此外,如果您想查看当前分支与其他分支(例如 origin/master)的差异,您也可以这样做。您只需右键单击根目录并将鼠标悬停在 Git 菜单上,然后单击与 Branch 比较并选择 master,您就可以一起查看所有差异,就像在 Github 上查看 Pull 请求一样。

JetBrains products like IntelliJ, GoLand, PyCharm etc all have the diff tool built-in. If you want to have a diff between current commit vs previous commit you just right click on the left of code line and turn on Annotation, then click any annotation you will view the all the files diff.

Furthermore, if you want to view the diff of current branch vs another branch like origin/master you can do that too. You just right click on the root directory and hover over to Git menu and you click Compare with Branch and select master you view all the diffs together just like viewing a Pull Request on Github.

骄傲 2024-10-09 17:56:49

我知道您正在寻找 GUI 而不是 TUI,但 vi/vim/vimdiff 会显示带有语法突出显示的 diff 文件:viewchanges.diff,其中 changes.diff 是通过执行 git --no-pager diff > 创建的更改.diff。我一直在到处寻找可以读取这些文件之一的 GUI,但无济于事 - meld 有一个 --comparison-file=COMPARISON_FILE 选项,但无论比较文件格式是什么,它都不适用于常规(统一)差异输出。

I know you're looking for a GUI rather than a TUI, but vi/vim/vimdiff will display a diff file with syntax highlighting: view changes.diff, where changes.diff was created by doing git --no-pager diff > changes.diff. I've been looking all over the place for a GUI that will read one of these files, to no avail - meld has a --comparison-file=COMPARISON_FILE option, but whatever that comparison file format is, it doesn't work with regular (unified) diff output.

会发光的星星闪亮亮i 2024-10-09 17:56:49

git diff 有一个 --ext-diff 选项将 diff 输出传送到外部 diff 程序。已知可与 Git 配合使用的流行开源 diff 程序包括 kdiff3Meld

git diff has a --ext-diff option that pipes the diff output to an external diff program. Popular open source diff programs that are known to work with Git include kdiff3 and Meld.

装纯掩盖桑 2024-10-09 17:56:49

git difftool 将运行所有流行的工具,例如 meld、tkdiff 等。对于合并,您还可以运行 git mergetool。

git difftool will run all popular ones like meld, tkdiff, etc. Also for merges you can run git mergetool.

双手揣兜 2024-10-09 17:56:49

我不确定我是否正确理解了你的问题,但显然在 SmartGit 的下一个版本中(2.0,目前在 alpha 中可用),您可以使用日志窗口在任意提交之间进行差异 - 不过我还没有尝试过。

I'm not sure I've understood your question correctly, but apparently in the next version of SmartGit (2.0, currently available in alpha), you can use the log window to do diffs between arbitrary commits - I haven't tried yet though.

蓝天 2024-10-09 17:56:48

从 git v1.7.11 开始,您可以使用 git difftool --dir-diff< /a> 执行目录比较。

以下答案适用于 v1.7.11 之前的 git 安装。


正如其他人提到的,git difftool 可用于在 GUI 中打开差异。但是,如果您有多个进行更改的文件,它将为每个文件打开一个单独的 GUI 实例。

我编写了一个脚本来解决这个“功能”,并允许在单个 GUI 实例中打开所有文件。您可以在 GitHub 上找到 git diffall 脚本

另外,您可能对这个相关的问题感兴趣:

git difftool,立即打开所有 diff 文件,而不是串行

Starting with git v1.7.11, you can use git difftool --dir-diff to perform a directory diff.

The answer that follows applies to git installations older than v1.7.11.


As mentioned by others, git difftool may be used to open your diff in a GUI. However if you have multiple files with changes, it will open a separate instance of the GUI for each file.

I wrote a script to work around this "feature" and allow all the files to be opened in a single GUI instance. You can find the git diffall script on GitHub.

Also, you may be interested in this related SO question:

git difftool, open all diff files immediately, not in serial

半窗疏影 2024-10-09 17:56:48

如果您想要一个人性化的 UI,但仍想留在终端内,您可以使用:

git tui diff [args...]

!demo

安装

git-tui

sudo snap install git-tui

https://github.com/ArthurSonzogni/git-tui

免责声明:我是作者。

它是一个在 MIT 许可下的开放项目。

If you want a human friendly UI, but still want to stay within your terminal, you can use:

git tui diff [args...]

!demo

Install

git-tui

sudo snap install git-tui

https://github.com/ArthurSonzogni/git-tui

Disclaimer: I am the author.

It is an open source project under the MIT license.

蹲在坟头点根烟 2024-10-09 17:56:48

Beyond Compare 很好地做到了这一点 - 创建 .diff 文件的基本“git diff”命令不需要进行任何配置更改。 Beyond Compare 显示文件树视图中 .diff 文件引用的所有文件以及您选择的每个文件的差异。

在Beyond Compare中,使用“工具->”查看补丁的菜单选项

Beyond Compare does this nicely - no configuration changes needed to the basic 'git diff' command which creates the .diff file. Beyond Compare shows all the files, that are referenced in the .diff file in a file tree view and the diff for each file as you select it.

In Beyond Compare, use the 'Tools -> View Patch' menu option

人海汹涌 2024-10-09 17:56:48

这是执行此操作的一个网站 - Diffy - 共享差异的工具。

您可以在其中粘贴差异文本输出,或上传包含差异输出的文件,然后它会自动在树资源管理器上显示差异。这对于您没有任何权限在计算机上安装程序的情况很有用(谢谢雇主!)。

编辑:请小心不要暴露敏感代码!

Here is a site to do this - Diffy - A tool for sharing diffs.

There you can paste your diff text output, or upload a file containing the diff output, then it automatically shows the diff on a tree explorer. It's good for scenarios where you don't have any permissions to install programs on your machine (thanks, employer!).

EDIT: Just be careful not to expose sensitive code!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文