Configuring a diff-tool for Git on Windows

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?


I'm on WIndows 7 using MSysGit v1.8.4.

For me, the only solution was to add p4merge to the system path variable (reboot needed afterwards). Having done this, i conf'd it like this:

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

I recommend you stick to "git config" instead of editing the conf manually because hyphens etc sometimes are different between these methods.


Dan Limerick has an excellent short tutorial on setting up Perforce's p4merge on Windows:

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

Tested with Git 1.9.4 and p4merge 2014.1 on Windows 7.

Tags:

Git

Merge

Diff