开发者

Explore git-diff output in a GUI?

开发者 https://www.devze.com 2023-01-24 11:20 出处:网络
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 work

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 di开发者_运维问答fferent 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.

Explore git-diff output in a GUI?


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


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

git tui diff [args...]

Explore git-diff output in a GUI?

Install

Explore git-diff output in a GUI?

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.


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


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.


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!).


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.


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消