This answer is great for seeing a visual diff between two files that are checked into git: How do I view 'git diff' output with a visual diff program?
Howev
To see a visual diff of all differences between two branches I like to merge the two branches - WITHOUT committing the merge - and then use git gui
or git Extensions to get an overview of the differences.
Git command line for merging without commiting:
git checkout branchA git merge --no-commit --no-ff branchB
Then when done, you can undo the merge with
git merge --abort
(h/t to @jcugat's for the comment)
git show-branch
There's a lot you can do with core git functionality. It might be good to specify what you'd like to include in your visual diff. Most answers focus on line-by-line diffs of commits, where your example focuses on names of files affected in a given commit.
One visual that seems not to be addressed is how to see the commits that branches contain (whether in common or uniquely).
For this visual, I'm a big fan of git show-branch
; it breaks out a well organized table of commits per branch back to the common ancestor.
- to try it on a repo with multiple branches with divergences, just type git show-branch
and check the output
- for a writeup with examples, see Compare Commits Between Git Branches
Here is how to see the visual diff between whole commits, as opposed to single files, in Visual Studio (tested in VS 2017). Unfortunately, it works only for commits within one branch: In the "Team Explorer", choose the "Branches" view, right-click on the repo, and choose "View history" as in the following image.
Then the history of the current branch appears in the main area. (Where branches that ended as earlier commits on the current branch are marked by labels.) Now select a couple of commits with Ctrl-Left, then right click and select "Compare Commits..." from the pop-up menu.
For more on comparing branches in the Microsoft world, see this stackoverflow question: Differences between git branches using Visual Studio.
You can use the free P4Merge from Perforce to do this as well:
http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools
Details on integrating it with Git can be found here and here
but a quick summary from the above links is:
$ git mergetool
and $ git difftool
to use p4merge$ git diff
will still just use the default inline diff viewer :) (tested with git version 1.8.2)[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
tool = p4merge
[difftool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$REMOTE\"" "\"$LOCAL\""