error with p4merge merging tool in git

12,536

Solution 1

It works for me:

[merge]
    keepBackup = false;
    tool = p4merge
[mergetool "p4merge"]
    path = C:/Program Files/Perforce/p4merge.exe
    cmd = \"C:/Program Files/Perforce/p4merge.exe\" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false
[difftool]
    prompt = false
[mergetool]
    prompt = false

Solution 2

Why is everything so hard I hate to write commands so what I did?

  1. Install p4Merge tool form here serach for P4Merge and install the exe then you need only

enter image description here

  1. Install it as Windows user

  2. Go into your user direcotry and search for .gitconfig edit it and add

[mergetool "p4merge"]
  path = C:\\Program Files\\Perforce\\p4merge.exe
  cmd = \"C:/Program Files/Perforce/p4merge.exe\" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
[merge]
  tool = p4merge

How to use it? When you pull something and have conflicts you can just write

git mergetool

And the tool will be open.

enter image description here

At the bottom is you final version you can edit there then just save and commit and the conflict will be resolved.

Solution 3

You may also need to restart your git console if you've just installed p4merge, for the updated environment variables to register.

Solution 4

After I installaed P4Merge, I followed the instructions on this page and it works perfectly for me.

https://gist.github.com/tony4d/3454372

Solution 5

It looks like it can't find p4merge so try adding "C:\Program Files\Perforce\" to your PATH environment variable via System Properties.

Share:
12,536
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin about 2 years

    I have setup my classpath for p4merge an set the file .gitconfig, but there i get this error when the p4merge tool suppose to opem those two files that are in conflict. anybody knows the solution?

    added to classpath: "C:\Program Files\Perforce\p4merge.exe" added to .gitconfig file:

    [merge]
        tool = p4merge
    [mergetool "p4merge"]
        cmd = p4merge.exe \\\"$BASE\\\" \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$MERGED\\\"
    

    ERROR MESSAGE:

    Normal merge conflict for 'protected/views/layouts/main.php':
      {local}: modified file
      {remote}: modified file
    Hit return to start merge resolution tool (p4merge):
    C:\Program Files (x86)\Git/libexec/git-core/mergetools/p4merge: line 8: p4merge:
     command not found
    protected/views/layouts/main.php seems unchanged.
    Was the merge successful? [y/n] n
    merge of protected/views/layouts/main.php failed