4

I am trying to use beyond compare 2 with Git as a mergetool, following this example: http://www.iokom.com/drupal/node/4

The example uses beyond compare 3, so I simply substituted my directory structure, I'm not surprised it didn't work. I have looked around, but most tutorials use BC3, and many posts here. Is BC2 compatible?

I edited my global config file as shown in the link, but get the following...

Mark@MARK-PC /c/git ((ref: re...))
$ git mergetool
fatal: bad config file line 27 in C:\Program Files (x86)\Git/etc/gitconfig

How might I go about using BC2? What does this error mean? Is it giving out about my path or are the parameters in the config wrong for BC2? Thanks in advance!

marked
  • 589
  • 9
  • 24

1 Answers1

3

Beyond Compare 2 does not support 3-way merging with an ancestor so the directions as written won't work. You can configure it to do a 2-way merge using the /savetarget= switch. Try this configuration instead:

[merge]
tool = bc2

[mergetool "bc2"]
cmd = 'C:\Program Files (x86)\Beyond Compare 2\BC2.exe' \
  "$PWD/$LOCAL" \
  "$PWD/$REMOTE" \
  /savetarget="$PWD/$MERGED"
keepBackup = false
trustExitCode = false

Note that since it isn't able to use the ancestor file it can't detect conflicts. You'll have to go through the files and merge everything manually. Also, the interface is still the 2-way comparison; you need to pull all of the changes from one file into the other and then save it. The /savetarget switch makes it so any time you save either file it will actually overwrite that path.

Zoë Peterson
  • 13,094
  • 2
  • 44
  • 64
  • very informative, thanks! Do you think there is much benefit in using BC2 with git then? Or is it best to just invest in BC3 – marked Dec 13 '12 at 12:07
  • @marked: If you only do an occasional merge with minimal conflicts then BC2 works, but BC3 support is much better. In many cases you can just accept its automated merge results as-is, whereas with BC2 you need to manually pull all of the changes over and basically guess if there are conflicting changes. I'd personally never go back to a 2-way only compare for merge conflicts, and I think BC3 is well worth the month, but I am the lead developer, so I'm a bit biased. :) – Zoë Peterson Dec 13 '12 at 21:19
  • @marked: If you want to test it, BC2 and BC3 can be installed side-by-side and have separate settings files, so you can try it out and swap back and forth between them without losing anything. The BC3 trial is fully functional. – Zoë Peterson Dec 13 '12 at 21:21
  • Hi again @Craig, could use some help if possible :P With regard to the /savetarget. After resolving the conflict in BC2, git states that the file seems to be unchanged and I am left with many temp files, is this because my save target is not set correctly? – marked Feb 01 '13 at 17:18
  • My current config looks like this: [mergetool "bc2"] cmd = \"c:/Program Files (x86)/Beyond Compare 2/BC2.exe\" \"$PWD/$LOCAL\" \"$PWD/$REMOTE\" /savetarget=\"$PWD/$MERGED\" – marked Feb 01 '13 at 17:19
  • @marked You should email support@scootersoftware.com; our normal support guys will be able to spend more time reproducing/diagnosing the issue than I can. – Zoë Peterson Feb 01 '13 at 22:55
  • Thanks @Craig, I will indeed. – marked Feb 04 '13 at 09:29
  • @marked: Did you get a reply from support or figure this out? – Hugo Jan 27 '14 at 07:37