Tuesday, April 21, 2020

Setting Beyond Compare as the default diff tool in Sourcetree

When you right click on a file that has changed in the Unstaged file panel of Sourcetree, you have an "External Diff" option. This post indicates that Sourcetree uses "whatever you have configured in your .gitconfig already as your default diff tool"

You can set Beyond Compare as your default diff tool by following the instructions posted here.

Diff
At a Windows command prompt, enter the commands:
  git config --global diff.tool bc
  git config --global difftool.bc.path "c:/Program Files (x86)/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 (x86)/Beyond Compare 4/bcomp.exe"

Note: For Git versions older than 2.2.0 (git --version) replace "bc" with "bc3" in the above instructions.

Launching Diffs and Merges

File Diff:
  git difftool filename.ext
Folder Diff:
  git difftool --dir-diff
3-way Merge:
  git mergetool filename.txt

Advanced Settings

To disable the "Launch 'bc3' [Y/n]?" prompt, run the command:
  git config --global difftool.prompt false
Git's default settings retain merge files with *.orig extensions after a successful merge.  To disable this safety feature and automatically delete *.orig files after a merge, run the command:
  git config --global mergetool.keepBackup false

Running the following command will open your .gitconfig file in an editor.
git config --edit --global

You will be able to see what the command did to edit your .gitconfig file.


No comments: