18

>>git difftool branch1 branch2 opens my difftool (Beyond Compare:BC) with every file that has a diff between the branches. I have to close BC after each file just for it to reopen with the next file.

BC can diff whole directories and multiple files.

Is there a way to get git difftool to open all files simultaneously, or diff the whole tree simultaneously?

Adi Shavit
  • 16,743
  • 5
  • 67
  • 137

2 Answers2

22

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.


This issue is not related to BC, but to the way git works. Fortunately, there is a solution at this URL - git-diffall

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
Olivier Refalo
  • 50,287
  • 22
  • 91
  • 122
  • Indeed, it is a Git issue. I tried, but I couldn't get it to work properly on Windows. The script ran fine (in the Bash shell) and BC opens in the right place, but the tmp files don't seem to exist. – Adi Shavit Jun 02 '11 at 07:21
  • In the end, I settled for this http://goo.gl/YPd2s. It was linked from the link you sent. So thanks! – Adi Shavit Jun 02 '11 at 07:27
  • funny it runs fine for me on windows and osx – Olivier Refalo Jun 17 '11 at 01:41
16

I used these commands to set Beyond Compare 4 (despite the bc3 you see in them) as the diff / merge tools:

git config --global diff.tool bc3
git config --global difftool.bc3.path "C:/Program Files/Beyond Compare 4/bcomp.exe"

git config --global merge.tool bc3
git config --global mergetool.bc3.path "C:/Program Files/Beyond Compare 4/bcomp.exe"

Then I compared two branches like this, where "oldbranchname" and "newbranchname" are the names of the two branches I wanted to compare.

git difftool -d --tool=bc3 oldbranchname newbranchname

I get the folder view as if I compared two folders with beyond compare. The only thing of note is that it will not show identical files in the comparison, but that has not bothered me.

Al Dass
  • 831
  • 15
  • 23
Christopher
  • 10,409
  • 13
  • 73
  • 97
  • 1
    Yes, the `-d` option does the the trick, is it equivalent to `--dir-diff` which works. – Adi Shavit Aug 31 '16 at 06:49
  • 2
    On a Mac I found I had to change the option to follow symlinks – Steve Sep 01 '17 at 23:37
  • The option to follow symlinks on the Mac with Beyond Compare 4 is not in the usual preferences area. BC4 staff note how to set it on their forum: https://www.scootersoftware.com/vbulletin/showthread.php?12751-Symlink-issue-with-git-difftool-dir-dif&s=ae3003e55568f92c53ecd9de3e06c65c&p=42576#post42576 – lantrix Apr 03 '18 at 01:15