Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up p4merge as diff tool for Visual Studio 2015 | git

I've managed to successfully wire up P4Merge with TortoiseGit through this tutorial.

However, given I'm spending most of my time in the IDE (Visual Studio 2015), I'd like to also set this one up to use P4Merge as a diff tool.

Previously (aka while working with TFS), this would be enough. However, given I'm now using git, there's no option in VS to wire it up this way:

enter image description here

However, I found out how to Configure User Tools through the Visual Studio 2015 Tools Developer Command Prompt and tf diff /configure, proceeded as in the previous tutorial with the .bat files, but it doesn't seem to do anything for me.

I'm probably missing something, but hoping that given how popular P4Merge, VS (& git) are nowadays, there have to be people who've managed to already achieve this by now.

like image 786
Alexandru Marculescu Avatar asked Sep 21 '16 07:09

Alexandru Marculescu


People also ask

Is p4merge still free?

P4Merge. Perforce, the company best known for its enterprise version control platform, also offers a solid diff tool: P4Merge is free of charge and comes with a basic feature set that makes it an interesting option on Windows, macOS and Linux.


1 Answers

I am assuming that you have P4Merge installed in the default install directory, if not edit the directory accordingly in the commands listed below.

Execute these commands in the command line to set Git's default mergetool and difftool to P4Merge.

git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global diff.tool p4merge
git config --global difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"

After that, whenever git difftool is launched it will start p4merge.

However, it can still be that on the repository level there is still a setting that overrides the global settings, this is located in .git/config You can manually edit the config file, or you can open up a command line, change directory into the repository and change the default merge and difftool with the following commands.

git config --local merge.tool p4merge
git config --local mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --local diff.tool p4merge
git config --local difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
like image 87
Jeroen Avatar answered Oct 26 '22 00:10

Jeroen