Since git diff
in powershell mostly results in a unreadable amount of whitespace or strange characters, I installed Perforce P4Merge, to handle merging and diff.
However, I can't make git diff
open the p4merge application to view the diff in. So far my .gitconfig looks like this:
[diff]
tool = p4diff
[difftool "p4diff"]
external = 'C:/PROGRA~1/Perforce/p4merge.exe "$LOCAL" "$REMOTE"'
prompt = false
[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
path = 'C:/PROGRA~1/Perforce/p4merge.exe'
prompt = false
keepBackup = false
keepTemporaries = false
trustExitCode = false
The paths are correct. But alas, git still attempts to present the diff in Powershell, when using git diff
.
So what's the trick to make this work?
In your command prompt, try: git config --global diff.tool p4diff
That worked for me, using a config file set up as you had described:
[diff]
tool = p4merge
[difftool "p4diff"]
external = '"C:/Program Files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"'
Running git difftool
opened p4merge as expected.
Ref: How do I view 'git diff' output with a visual diff program?