Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Last active March 24, 2024 23:03
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save crmaxx/e8674c6228f4409f3bc6dd7337f95774 to your computer and use it in GitHub Desktop.
Save crmaxx/e8674c6228f4409f3bc6dd7337f95774 to your computer and use it in GitHub Desktop.
Installing and configuring P4Merge for Git on Ubuntu
# based on http://blogs.pdmlab.com/alexander.zeitler/articles/installing-and-configuring-p4merge-for-git-on-ubuntu/
$ cd ~/Downloads
$ wget https://cdist2.perforce.com/perforce/r18.2/bin.linux26x86_64/p4v.tgz
$ tar zxvf p4v.tgz
$ sudo mkdir /opt/p4v
$ cd p4v-2018.2.1666551
$ sudo mv * /opt/p4v
$ sudo ln -s /opt/p4v/bin/p4merge /usr/local/bin/p4merge
~/.gitconfig
[color]
ui = true
diff = true
branch = auto
status = auto
[alias]
new = checkout -b
co = checkout
ci = commit
cm = commit -m
cam = commit -am
ca = commit --amend # careful
st = status
br = branch
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen--> %cr%Creset by %Cblue%cN <%cE>%Creset' --abbre
v-commit --date=relative
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
s = status --short
a = !git add . && git status
au = !git add -u . && git statustus
aa = !git add . && git add -u . && git status
ac = !git add . && git commit
acm = !git add . && git commit -m
put = push origin HEAD
get = pull origin HEAD
[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
@mrgiraldoo
Copy link

$ sudo ln -s /opt/p4v/bin/p4merge /usr/local/bin/p4merge What does this command do?

ALso, when I type:
$ sudo mkdir /opt/p4v
where is the opt directory created? in Downloads? or in Home?

@crmaxx
Copy link
Author

crmaxx commented May 25, 2020

@mrgiraldoo

$ sudo ln -s /opt/p4v/bin/p4merge /usr/local/bin/p4merge What does this command do?

It create symbolic link from /opt/p4v/bin/p4merge to /usr/local/bin/p4merge

ALso, when I type:
$ sudo mkdir /opt/p4v
where is the opt directory created? in Downloads? or in Home?

in root dir /

@mrgiraldoo
Copy link

Thanks a lot for taking the time to repply. I was having issues installing p4merge, I think your post just saved me, I have run the configs with git, let's see if it works :)

@kryvosheiaivan
Copy link

$ cd p4v-2018.2.1666551
doesnt work
ver is different

@crmaxx
Copy link
Author

crmaxx commented Jun 17, 2021

$ cd p4v-2018.2.1666551
doesnt work
ver is different

of course, this log was made in 2018 :)

@Artureio
Copy link

Thanks 😃

@cesaaargm
Copy link

thx!

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