Skip to content

Instantly share code, notes, and snippets.

@RohanBhanderi
Last active June 5, 2024 13:30
Show Gist options
  • Save RohanBhanderi/2b20592048f6b67368a7 to your computer and use it in GitHub Desktop.
Save RohanBhanderi/2b20592048f6b67368a7 to your computer and use it in GitHub Desktop.
Git Mergetool and difftool with Beyond Compare 4
//Git Mergetool and difftool with Beyond Compare 4
//For Windows
//IF running this command in git bash then escape $ with \
git config --global diff.tool bc4
git config --global difftool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
git config --global mergetool.bc4.trustExitCode true
@Chandrakanth339
Copy link

@jpluimers
Copy link

I stuck to this as I:

  • do not run git bash
  • have Beyond Compared installed in the default directory (not the x86 one)
  • do not want a new UI instance, so use the recommended BComp.exe
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd "'C:/Program Files/Beyond Compare 4/BComp.exe' \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
git config --global mergetool.bc4.trustExitCode true

This works splendid with git mergetool: it starts a merge in the already open BCompare.exe instance.

I only do merge from BeyondCompare, so no need for me to do a similar Beyond Compare setup for diff.tool, but if anyone wants it, it would be this:

git config --global diff.tool bc4
git config --global difftool.bc4.cmd "'C:/Program Files/Beyond Compare 4/BComp.exe' \"$LOCAL\" \"$REMOTE\""
git config --global difftool.bc4.prompt false

@dogeth
Copy link

dogeth commented Feb 14, 2019

The following will turn off the launch prompt:

git config --global difftool.prompt false

@xiaoyifang
Copy link

xiaoyifang commented May 3, 2023

BC3 logo BC version 3 or 4
Diff
At a Windows command prompt, enter the commands:
git config --global diff.tool bc
git config --global difftool.bc.path "c:/Program Files/Beyond Compare 4/bcomp.exe"
Note: For Git versions older than 2.2 (git --version) replace "bc" with "bc3" in the above instructions.

3-way Merge Pro only
At a Windows command prompt, enter the commands:
git config --global merge.tool bc
git config --global mergetool.bc.path "c:/Program Files/Beyond Compare 4/bcomp.exe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment