Explore git-diff output in a GUI?

22,462

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

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.

Solution 5

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

Share:
22,462
Frank
Author by

Frank

Updated on July 09, 2022

Comments

  • Frank
    Frank almost 2 years

    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