Frank
Frank

Reputation: 1081

Explore git-diff output in a GUI?

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

Upvotes: 30

Views: 43504

Answers (9)

Diego Victor de Jesus
Diego Victor de Jesus

Reputation: 3003

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!

Upvotes: 5

ArthurS
ArthurS

Reputation: 430

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.

Upvotes: 13

P Li
P Li

Reputation: 5222

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.

Upvotes: 2

russellg
russellg

Reputation: 61

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

Upvotes: 6

drkvogel
drkvogel

Reputation: 2581

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.

Upvotes: 1

Tim Henigan
Tim Henigan

Reputation: 62168

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

Upvotes: 18

Benjol
Benjol

Reputation: 66541

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.

Upvotes: 0

KiRPiCH
KiRPiCH

Reputation: 399

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

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 993085

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.

Upvotes: 0

Related Questions