Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beyond Compare as a Diff tool with Git - How to command line switch like: /expandall

My git global config C:\Users\.gitconfig looks like:

[diff]
tool = bc3

[difftool "bc3"]
path = C:/Program Files (x86)/Beyond Compare 3/BCompare.exe
cmd = \"C:/Program Files (x86)/Beyond Compare 3/BCompare.exe\" \"$LOCAL\" \"$REMOTE\"

I am using Windows 7 x64 OS. I have Beyond Compare Pro 3.3.5 version.

I want to pass one or more arguments when calling BCompare.exe I tried this, but it doesn't work:

cmd = \"C:/Program Files (x86)/Beyond Compare 3/BCompare.exe\ /expandall" \"$LOCAL\" \"$REMOTE\"

git difftool --dir-diff dev master

I want to do a directory compare between a dev and master branches and to expand all folders within Beyond Compare tool. This should do the same as a corresponding button in Beyond Compare GUI: Expand All which expands all folders in left and right pane.

I need to possibly pass 2 arguments: /solo /expandall

Thanks, Rad

like image 856
Rad Avatar asked Dec 12 '22 16:12

Rad


1 Answers

Use the form -expandall instead of /expandall, and note that -solo is required (explanation below).

[diff]
    tool = bc3
[difftool "bc3"]
    cmd = \"E:/PortApps/Beyond Compare 3/bcomp.exe\" -expandall -solo \"$LOCAL\" \"$REMOTE\"

The above works for me with Beyond Compare 3.3.8 (Standard Edition) and Git For Windows 1.8.4 (msysgit), on Windows XP SP3 (x86 32-bit).

Notes

  1. I found the path setting wasn't necessary if I provided cmd.

  2. You may need to use BCompare.exe instead of bcomp.exe, according to BC tech support ... but I found it worked fine either way.

Solo explained

The -solo option makes the comparison open in a new window. difftool will then wait for you to close it before deleting the temp files being compared.

Without this option, if you already have a Beyond Compare window open, the comparison will appear in a new tab there. This seems convenient but won't actually work, because difftool will have immediately deleted the files to be compared, since your invocation of bcomp.exe merely delegated the task to the already-running app and then exited.

like image 54
Sean Gugler Avatar answered Jan 05 '23 19:01

Sean Gugler