Setting up diff tool for Git on Windows

Since git diffpowershell mainly results in an unreadable amount of whitespace or strange characters, I installed Perforce P4Merge to handle merging and diff.

However, I cannot get git diffp4merge to open the diff viewer. 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

Ways are right. But alas, git is still trying to present diff in Powershell when used git diff.

So what's the trick to make this work?

+5
source share
4 answers

At the command prompt, try: git config --global diff.tool p4diff

This worked for me using the configuration file created as you described:

[diff]  
    tool = p4merge  
[difftool "p4diff"]  
    external = '"C:/Program Files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"'

git difftool p4merge, .

: 'git diff' ?

+10

WIndows 7, MSysGit v1.8.4.

p4merge ( ). , :

git config --global diff.tool p4merge
git config --global difftool.p4merge.cmd 'p4merge.exe $LOCAL $REMOTE'
git config --global difftool.prompt false

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd 'p4merge.exe $BASE $LOCAL $REMOTE $MERGED'
git config --global mergetool.prompt false
git config --global mergetool.trustExitCode false
git config --global mergetool.keepBackup false

"git config" conf , .. .

+9

Perforce p4merge Windows:

http://danlimerick.wordpress.com/2011/06/19/git-for-window-tip-use-p4merge-as-mergetool/

Git 1.9.4 p4merge 2014.1 Windows 7.

+2
  • git config --global diff.tool p4merge
  • git config --global difftool.p4merge.cmd "p4merge \" $ LOCAL \ "\" $ REMOTE \ ""
  • add the p4merge.exe path ("C: \ Program Files \ Perforce \ p4merge.exe") to the environment path

ps:

  • in step 2 you must add \ "$ LOCAL \" \ "$ REMOTE \" (local diff remote), or p4merge will not know what diff is for
0
source

All Articles