Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setup p4merge as git mergetool in Windows (cmd & PS)
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
@AlexByte

This comment has been minimized.

Copy link

AlexByte commented May 6, 2017

I don't like tabs order REMOTE, BASE, LOCAL. It's better to use
git config --global mergetoll.p4merge.cmd "'C:/Program Files/Perforce/p4merge.exe' $BASE $LOCAL $REMOTE $MERGED"

@Ziriax

This comment has been minimized.

Copy link

Ziriax commented Feb 26, 2018

The above code has a small typo, the copy/paste-able lines should be:

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd "'C:/Program Files/Perforce/p4merge.exe' $BASE $LOCAL $REMOTE $MERGED"
@808codist

This comment has been minimized.

Copy link

808codist commented Apr 5, 2018

This is what worked for me, as entered in Git Bash:

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd "'C:/Program Files/Perforce/p4merge.exe' \$BASE \$LOCAL \$REMOTE \$MERGED"

1st command is same as others.

For the 2nd command, the \ before each $ prevents bash from trying to treat the last 4 arguments as environment variables.

@daveamol

This comment has been minimized.

Copy link

daveamol commented Oct 12, 2018

This is what worked for me, as entered in Git Bash:

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd "'C:/Program Files/Perforce/p4merge.exe' \$BASE \$LOCAL \$REMOTE \$MERGED"

1st command is same as others.

For the 2nd command, the \ before each $ prevents bash from trying to treat the last 4 arguments as environment variables.

Finally. I was trying to figure out howto get it to work for cmder. This works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.