error with p4merge merging tool in git

2019-06-15 20:44发布

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

标签: git p4merge
8条回答
爷的心禁止访问
2楼-- · 2019-06-15 21:19

If you don`t want to add p4merge in environmental variable Path (as Dan Lister mentioned) you could add parameter path in your git config:

[mergetool "p4merge"]
    path = C:/Program Files/Perforce/p4merge.exe

It works for me on git v1.7.11 (WinXP).

查看更多
相关推荐>>
3楼-- · 2019-06-15 21:20

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

查看更多
啃猪蹄的小仙女
4楼-- · 2019-06-15 21:35
These steps worked for me.

After downloading and installing P4Merge tool from perforce.com

After your profile name/email id.

Replace this content in your ~/.gitconfig file

 enter code here

[merge]
  keepBackup = false
    tool = p4merge
[mergetool "p4merge"]
    cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$LOCAL\""  "\"$PWD/$REMOTE\"" "\"$PWD/$MERGED\""   
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false
[diff]
    tool = p4merge
[difftool "p4merge"]
    cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$REMOTE\"" "\"$LOCAL\""
查看更多
霸刀☆藐视天下
5楼-- · 2019-06-15 21:37

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

查看更多
仙女界的扛把子
6楼-- · 2019-06-15 21:38

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
查看更多
你好瞎i
7楼-- · 2019-06-15 21:40

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

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

查看更多
登录 后发表回答