How can I config git
to use p4merge
as my mergetool
?
Next is my current situation:
$ 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.
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
In order to see diff's (between Working directory to the staging area, for instance) you can now use the command:git difftool
that will open the p4merge GUI to be used.
NOTE: git diff
will still work and will display the diffs in the terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With