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

1

6

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.

Xeniaxeno answered 21/9, 2016 at 7:31 Comment(0)
R
9

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"
Rotary answered 28/9, 2016 at 2:38 Comment(3)
besides the fact that I would also need to config the difftool (not just the mergetool), this doesn't exactly answer my question, nor solve my problemXeniaxeno
I have corrected my answer, I have tested it on my machine and it works for me. Here is a GIF of me opening P4Merge as my standard diff tool in VS2015: i.imgur.com/Dx5h9RS.gifvRotary
I love this solution. It's much butter that digging in VS preferences. Besides, I am not going to use any VS tools... never.Insessorial

© 2022 - 2024 — McMap. All rights reserved.