p4merge and Git 1.8.3
I just posted an article that explains how to integrate Git with P4Merge along with a launcher script that irons out few discrepencies: http://pempek.net/articles/2014/04/18/git-p4merge/
The article Installing and Using P4Merge in Git for Windows worked for me.
Edit your global .gitconfig and add the following sections (you don't have to worry about where p4merge.exe is located, it was added to your path during the installation):
[diff]
tool = p4merge
[difftool "p4merge"]
cmd = "p4merge.exe $LOCAL $REMOTE"
[merge]
tool = p4merge
[mergetool "p4merge"]
cmd = "p4merge.exe $BASE $LOCAl $REMOTE $MERGED"
trustExitCode = true
keepTemporaries = false
keepBackup = false
prompt = false
There is one caveat, in order to run "git difftool' or "git mergetool" you have to first run "git diff" or "git merge" and have a difference or conflict. The editor will then launch with the correct files ready for editing.
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" sop4merge
will be used as bothgit
'sdifftool
&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.