4

I've tried setting up p4merge as my mergetool, but I can't seem to get it working. Here's my commands:

git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global mergetool.p4merge.cmd "p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""

And here's the error I'm getting: enter image description here

I've also tried installing a portable version of git and running the commands from a windows cmd prompt and I still get a similar error.

Any ideas here? I'm stumped.

Edit

Strangely enough, after I've set up p4merge via git bash and it failed, I tried merging in Visual Studio's Team Explorer and it launched p4merge (tableflip). I imagine the command that kicks off via VS is similar to git bash, but I'm not sure how to correlate the two.

Edit 2:

Here's my git status showing my merge conflict status: enter image description here

Fillip Peyton
  • 3,637
  • 2
  • 32
  • 60
  • Can you do a git status and show me the answer. You don't seem to have file to merge. Try also `git mergetool --tool=p4merge` – Flows May 26 '16 at 16:13
  • Sure thing. Edited post with your suggestion. – Fillip Peyton May 26 '16 at 16:26
  • You have a permission denied error. Could you check you can access to C:\Program Files\Git\* ? Does the command to launch p4merge works from the command line without error ? – Flows May 27 '16 at 06:49
  • @Flows - Both running [`git-bash.exe`](https://dl.dropboxusercontent.com/u/5772230/git/git-bash.png) and [`p4merge.exe`](https://dl.dropboxusercontent.com/u/5772230/git/p4merge.png) from their respective locations works from the same git bash window. – Fillip Peyton May 27 '16 at 22:11
  • @Flows - Any other ideas? – Fillip Peyton May 28 '16 at 19:30
  • Does the launch of git-mergetool also work ? Do you have access right in the repository ? Also be sure to have last version of git/git gui. Unfortunately I don't have any idea so far. – Flows May 29 '16 at 07:20
  • Please include error messages and code as text in the question, instead of linking to images on external sites. The linked images are now not available anymore, making this question rather useless. – mkrieger1 Feb 11 '19 at 21:44

1 Answers1

1

First, try those same config command form a regular cmd session (as I mentioned in "escape double quotes in git config from cmd").
Just make sure you have unzipped the latest git-for-windows (PortableGit-2.8.3-64-bit.7z.exe) in, for instance, C:\git, and added C:\git\bin to your %PATH%.

Second make sure you have files that need merging, ie. that have unresolved merge conflicts (with merge conflict markers in them), in order for git mergetool to work.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1) Tried setting .gitconfig from windows cmd. I have [this as my global .gitconfig](https://www.dropbox.com/s/e51as6bzcntcck1/global-gitconfig.png?dl=0). I have added my git bin directory to my `%PATH%` var. When I try running `git mergetool`, I still get [the same error](https://www.dropbox.com/s/llciqff3uajz3dm/mergetool-error.png?dl=0). 2) I definitely have the `<<<< ====== >>>>>` conflict markers. Any ideas why? The error sounds more low level to me, but what do I know? ¯\_(ツ)_/¯ – Fillip Peyton May 23 '16 at 17:09
  • @FillipPeyton Try it from a CMD session using a git unzipped in a folder without any space. And make sure git status does indicate that you have files with conflicts. – VonC May 23 '16 at 17:26
  • Just tried that. Getting different, but [similar results](https://www.dropbox.com/s/qwfihh0tif2ngk9/windows-cmd-git.png?dl=0). Lots of sh command errors. – Fillip Peyton May 23 '16 at 17:57
  • Strangely enough, after I've set up p4merge via git bash and it failed, I tried merging in Visual Studio's Team Explorer and [it launched p4merge](https://www.dropbox.com/s/cc3yc89307yulmh/vs-git.jpg?dl=0) (tableflip) – Fillip Peyton May 24 '16 at 00:12
  • @FillipPeyton Once Visual Studio has launched p4merge, could you launch a Process Explorer (https://technet.microsoft.com/en-us/sysinternals/bb896653)? You would see the full command line used by Visual Studio to launch said merge tool. – VonC May 24 '16 at 07:06
  • it looks like the command is equivalent to what I have in my gitconfig: `"C:\Program Files\Perforce\p4merge.exe" "C:\Users\fpeyton\AppData\Local\Temp\TFSTemp\vctmp18592_875859.AccountSettings.Enterprise.fb6784be.cshtml" "C:\Users\fpeyton\AppData\Local\Temp\TFSTemp\vctmp18592_563070.AccountSettings.Enterprise.08586638.cshtml" "C:\Users\fpeyton\AppData\Local\Temp\TFSTemp\vctmp18592_493710.AccountSettings.Enterprise.2bf63a5c.cshtml" "C:\Users\fpeyton\AppData\Local\Temp\TFSTemp\vctmp18592_198233.AccountSettings.Enterprise.08586638merge.cshtml" `. – Fillip Peyton May 24 '16 at 17:00
  • When I try to use the Process Explorer with git-bash/mintty, I don't see any processes being started under git-bash/mintty. – Fillip Peyton May 24 '16 at 17:04
  • any additional help? Your original answer doesn't solve my question. – Fillip Peyton May 28 '16 at 19:30
  • @FillipPeyton No: I tried but could not reproduce the issue on my side. I usually don't use git bash, only regular CMD session. – VonC May 28 '16 at 19:32