Created
April 19, 2017 14:30
-
-
Save mikemichaelis/4f6d62a03300a24e97c1d19b9413371e to your computer and use it in GitHub Desktop.
Setup p4merge as git mergetool in Windows (cmd & PS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global merge.tool p4merge | |
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe" |
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"
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.
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
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"