Mah*_*amy 9 git mergetool p4merge
我如何配置git以p4merge用作我的mergetool?
接下来是我现在的情况:
$ git --version
git version 1.8.3.msysgit.0
$ git mergetool
This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
tortoisemerge emerge vimdiff
No known merge tool is available.
Run Code Online (Sandbox Code Playgroud)
Guy*_*ham 19
To install p4merge and set it as git's difftool & mergetool on a Linux machine (Ubuntu 16.04) I did the following:
Go to the Downloads page of Perforce website, and in the search bar write: p4merge.
Chose the p4merge for Linux platform and download it (note that you can skip the registration).
Once downloaded extract it and copy the contents of the folder to a new folder /opt/p4merge:
a) gunzip p4v.tgz
b) tar xvf p4v.tar
c) sudo mkdir /opt/p4merge
d) I have downloaded it to /home/guya/Downloads and the "extracted" p4merge folder was (08/19) p4v-2019.1.1830398, so in my case the command was:
sudo mv /home/guya/Downloads/p4v-2019.1.1830398/* /opt/p4merge
Create a symbolic link to the p4merge executable with the command:sudo ln -s /opt/p4merge/bin/p4merge /usr/local/bin/p4merge
Add the following commands to git's "global config settings" so p4merge will be used as both git's difftool & mergetool:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path /usr/local/bin/p4merge
git config --global mergetool.prompt false
git config --global diff.tool p4merge
git config --global difftool.p4merge.path /usr/local/bin/p4merge
git config --global difftool.prompt false
为了查看差异(例如,在工作目录和暂存区之间),您现在可以使用以下命令:git difftool这将打开要使用的 p4merge GUI。
注意:git diff仍然可以工作,并将在终端中显示差异。
我刚刚发布了一篇文章,解释了如何将 Git 与 P4Merge 集成,以及消除一些差异的启动器脚本:http ://pempek.net/articles/2014/04/18/git-p4merge/