21.10.08

Using Beyond Compare as a Git Mergetool

At the October #altnetseattle meeting, we talked about git and Aaron Jensen mentioned a nice merge tool called p4merge, which I hadn't heard of before. I hadn't been able to get a merge tool to work right with msysgit before, so knowing Aaron was using p4merge with git led me to try again.

I actually still prefer beyond compare to p4merge - p4merge is nice and looks snazzy, but BC has all the right keystrokes and shows me just the right information when I am trying to do a merge.

To get it to work with git, I added this to my global git config ("C:\Program Files\git\etc\config"):




[merge]
tool = bc3 # This will be the default merge tool invoked by git mergetool.
[mergetool "bc3"]
cmd = C:/Users/cbilson/Desktop/BC3/bcomp.com \
"$PWD/$LOCAL" \
"$PWD/$REMOTE" \
"$PWD/$BASE" \
"$PWD/$MERGED"
keepBackup = false
trustExitCode = false


I had trouble getting it to run from "C:/Program Files/..." or even "C:/Program\ Files/..." so I did a portable install of BC and run it from there.

3 comments:

Anonymous said...

Excellent! Thanks for the post Chris.

In my case I updated "~/.gitconfig" instead of "C:\Program Files\git\etc\config"

JB

Anonymous said...

You can run it from c:\Program Files or c:\Program Files (x86) if you single-quote the command, which prevents Bash from interpreting the string.

cmd = 'C:/Program Files (x86)/Beyond Compare 3/bcomp.exe' \
... additional params

Chris Bilson said...

Cool! I was just having another crack at this the other day too. Thanks, James!