Visual Merge and Diff tool installation - UnbDroid/AprendendoGithub GitHub Wiki

For futher use, we have to install a difftool. The Difftool which we are going to use is the P4Merge.

To install the tool on Ubuntu, we are going to use the tutorial: How to install P4merge on Ubuntu

Frist of all, download the file selecting your computer configurations through the link: Visual merge tool - Downloads.

After doing that, go to your donwloaded folder(in my case it was ~/Downloads/) and extract the downloaded file. There is a folder called p4v-2017.3.1601999 and inside it there are two folders called bin and lib. On terminal, type the followed commands:

sudo mkdir /opt/p4merge
sudo mv * /opt/p4merge
sudo ln -s /opt/p4merge/bin/p4merge /usr/local/bin/p4merge

If you are using another operational system, google how to install P4merge on your operational system.

Now, open the .gitconfig using sublime typing the command on terminal:

subl ~/.gitconfig

and increase the following lines at the end of file:

[merge]
    keepBackup = false;
    tool = p4merge
[mergetool]
    prompt = false
[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false
[diff]
    tool = p4merge
[difftool]
    prompt = false
[difftool "p4merge"]
    cmd = p4merge "$LOCAL" "$REMOTE"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false

Save and close.