Skip to content

Instantly share code, notes, and snippets.

@thierrydev
Last active June 29, 2023 19:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thierrydev/4729182c6e0728134d5b99f0095409b8 to your computer and use it in GitHub Desktop.
Save thierrydev/4729182c6e0728134d5b99f0095409b8 to your computer and use it in GitHub Desktop.
Installing and configuring P4Merge for Git on Ubuntu

Installing and configuring P4Merge for Git on Ubuntu

cd ~/Downloads
wget https://cdist2.perforce.com/perforce/r19.1/bin.linux26x86_64/p4v.tgz
tar zxvf p4v.tgz
sudo mkdir /opt/p4v
cd p4v-2019.1.1865170
sudo mv * /opt/p4v
sudo ln -s /opt/p4v/bin/p4merge /usr/local/bin/p4merge
sudo nano ~/.gitconfig

Add the following if you only want to use p4merge as a diff tool

[diff]
    tool = p4merge
[difftool]
    prompt = false
[difftool "p4merge"]
    cmd = p4merge "$LOCAL" "$REMOTE"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false

Add the following if you also want to use p4merge as a merge tool

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

Enjoy

git difftool branchOne/pathToFile/file.ts branchTwo/pathToFile/file.ts

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment