Feb 5 2010

Using Beyond Compare For Merges in Git on Windows

Category: ToolsAlexRobson @ 17:35

I’ve seen several tutorials and blog entries that don’t quite get the syntax correct, (especially if the path contains spaces). This is a short blog post, but after an hour of fiddling with the syntax to try and get git to use BC3, I figured having the information available makes it worth it:

The following entry needs to go in your .gitconfig file:

[merge]
    tool = bc3
[mergetool "bc3"]
    cmd = \"[path to beyond compare]/bcomp.com\" \"$PWD/$LOCAL\" \"$PWD/$REMOTE\" \"$PWD/$BASE\" \"$PWD/$MERGED\"
    keepBackup = false
    trustExitCode = false

Just to for clarity’s sake, a concrete example on my machine looks like this: (Beyond Compare 3 installed on a x64 Windows 7 machine):

[merge]
    tool = bc3
[mergetool "bc3"]
    cmd = \"c:/program files (x86)/Beyond Compare 3/bcomp.com\" \"$PWD/$LOCAL\" \"$PWD/$REMOTE\" \"$PWD/$BASE\" \"$PWD/$MERGED\"
    keepBackup = false
    trustExitCode = false

To find where .gitconfig file is located, you can issue the following commands from the git bash prompt:

cd ~
pwd

This will change directory to your home path and then print the full path to the console. Happy merging!

Tags: ,

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading