当我执行git mergetool而不是filemerge时如何获取p4merge


0

我在macOS Mojave,Git版本2.19.0上

这样做时git mergetool,而不是p4merge, filemerge出现。

搜索了我的整个驱动器,我看到的p4merge的唯一实例在

/Applications/Sourcetree.app/Contents/Resources/git_local/libexec/git-core/mergetools/p4merge

我是否缺少某些东西,我想也许我需要安装p4merge或其他东西。

这是我已经完成的工作:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

brew cask install p4merge

当我运行上面的命令时,我得到一个错误

(master) ✚ >M< > brew cask install p4merge
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
Updating Homebrew...
Ignoring commonmarker-0.17.11 because its extensions are not built.  Try: gem pristine commonmarker --version 0.17.11
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
conan

Error: Cask 'p4merge' is unavailable: No Cask with this name exists.

什么是p4merge?它不是标准的Apple或git工具
标记

它是查看git commit之间差异的工具。当您要查看图形格式的差异时,这就是您发出命令git mergetool时使用的。我在macOSX上做。
斯特赖克

因此,问题实际上是-我如何获得p4merge?与git无关
标记

@mark p4merge与git commit差异直接相关。您也可以使用difftool,但p4merge可以提供可视化输出。我不确定您是否可以单独使用p4merge
Stryker,

p4merge不是git的一部分-它是您需要付费的Perforce版本控制的一部分。您可以将其与git一起使用。
标记

Answers:


1

最好直接从供应商处安装p4merge,因为作者不维护其酿造桶。首先下载p4merge并从其下载页面拖放到您的应用程序:https ://www.perforce.com/downloads/visual-merge-tool

p4merge.app在下之后,/Applications您可以将git配置为使用p4merge作为默认的合并和差异工具。

该要点文档中有活跃的讨论,请从那里更好地检查最新进展https://gist.github.com/tony4d/3454372

您可以对Mojave使用以下配置。

[merge]
    tool = p4mergetool
    stat = true
[mergetool "p4mergetool"]
    cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepBackup = false
    keepTemporaries = false
    trustExitCode = false
    prompt = false
[diff]
    tool = p4mergetool
    renames = copies
    mnemonicprefix = true
[difftool "p4mergetool"]
    cmd = /Applications/p4merge.app/Contents/MacOS/p4merge "$LOCAL" "$REMOTE"
    keepBackup = false
    keepTemporaries = false
    trustExitCode = false
    prompt = false

这不回答问题的任择议定书并没有设法安装p4merge即使他们这样做了就不会是下/应用,因为它们技术使用自制软件
马克

我完全误解了。该答案是使p4merge在Mojave上工作的搜索结果之一,这不是一项简单的任务。我更新了答案,以包括如何在不使用brew的情况下正确安装p4merge。
哈利尔·卡斯卡瓦奇(Haril Kaskavalci)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.