我已经为p4merge设置了我的类路径设置文件.gitconfig,但是当p4merge工具假设打开那两个冲突的文件时,我得到了这个错误。有人知道解决方案吗?
添加到类路径:“C:\ Program Files \ Perforce \ p4merge.exe” 添加到.gitconfig文件:
[merge]
tool = p4merge
[mergetool "p4merge"]
cmd = p4merge.exe \\\"$BASE\\\" \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$MERGED\\\"
错误消息:
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
答案 0 :(得分:5)
它对我有用:
[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
答案 1 :(得分:4)
为什么一切都这么难我讨厌写命令所以我做了什么?
将其安装为Windows用户
进入您的用户目录并搜索 .gitconfig 编辑并添加
[mergetool "p4merge"] path = C:\\Program Files\\Perforce\\p4merge.exe cmd = \"C:/Program Files/Perforce/p4merge.exe\" "$BASE" "$LOCAL" "$REMOTE" "$MERGED" [merge] tool = p4merge
如何使用它?当你拉东西并发生冲突时,你可以写
git mergetool
该工具将会打开。
在底部是您可以在那里编辑的最终版本,然后保存并提交,冲突将得到解决。
答案 2 :(得分:3)
如果刚刚安装了p4merge,您可能还需要重新启动git控制台,以便更新要注册的环境变量。
答案 3 :(得分:2)
安装完P4Merge之后,我按照本页上的说明操作,对我来说非常适合。
答案 4 :(得分:1)
看起来它找不到p4merge所以尝试通过系统属性将“C:\ Program Files \ Perforce \”添加到PATH环境变量中。
答案 5 :(得分:0)
将完整的P4merge路径添加到.gitconfig。这是我的(注意路径分隔符被翻转,即c:/而不是c:\):
[merge]
tool = p4
[mergetool "p4"]
cmd = c:/winprogs/p4merge/p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
答案 6 :(得分:0)
如果您不想在环境变量Path中添加p4merge(如Dan Lister所述),您可以在git config中添加参数路径:
[mergetool "p4merge"]
path = C:/Program Files/Perforce/p4merge.exe
它适用于git v1.7.11(WinXP)。
答案 7 :(得分:0)
These steps worked for me.
从perforce.com下载并安装P4Merge工具后
在您的个人资料名称/电子邮件ID之后。
在〜/ .gitconfig文件中替换此内容
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\""
答案 8 :(得分:0)
将其用于正确的设置为合并工具。
$ git config --global merge.tool p4mergetool
$ git config --global mergetool.p4mergetool.cmd \ “ /Applications/p4merge.app/Contents/Resources/launchp4merge \ $ PWD / \ $ BASE \ $ PWD / \ $ REMOTE \ $ PWD / \ $ LOCAL \ $ PWD / \ $ MERGED”
$ git config --global mergetool.p4mergetool.trustExitCode false
$ git config --global mergetool.keepBackup false
答案 9 :(得分:0)
1)编辑您的git配置文件
git config --edit --global
2)添加以下内容(相应更改)
[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
[diff]
tool = p4mergetool
[difftool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge $LOCAL $REMOTEhere
3)初始化配置文件
git init
一切准备就绪,您准备好了。