I use windows 7. I want to use p4merge as Git diff/merge tool. I follow this article and this one to setup and config p4merge:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global diff.tool p4merge
git config --global difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
And these lines are from git config:
merge.tool=p4merge
mergetool.p4merge.path=C:/Program Files/Perforce/p4merge.exe
diff.tool=p4merge
difftool.p4merge.path=C:/Program Files/Perforce/p4merge.exe
mergetool.keeptemporaries=false
mergetool.prompt=false
Now git mergetool command works fine. But when I use git difftool command in git bash, I expect p4merge but I see internal implementation of diff in git bash.
I tried Smooth Git + P4merge but it does not work for me also I tried to do as described in External Merge and Diff Tools but I did not understand that.
Note:
When type of conflict is removed file conflict, git difftool command opens p4merge.
Not sure if helps, but recent versions of Git support P4Merge (I use
git version 2.17.0.on Windows through MSYS2).You can tell if this is the case or not by running
git difftool --tool-help. It'll list the available tools Git can use (because they've found them in your%PATH%) and the tools it could use (if they were installed).If
p4mergeis in this list then you just need to add the path wherep4merge.exeresides to your%PATH%(on Windows I recommend Rapid Environment Editor for this).After this is done you just need the following config to be in your
.gitconfigand nothing else. So remove other stuff like
difftool.pathand all that.Then just use
git difftoolorgit mergetoolto your hearts content.Note: I had a repository in which even if I did issue the
git difftoolorgit mergetoolcommands P4Merge wouldn't start. I'm not sure what was the problem in that repo. However I tried creating an empty repo somewhere on my drive withgit init, add a file, commit it, then modify it, then I trieddifftooland it worked. So if the above description doesn't work for you chances the problem lies somewhere else. Hope this helps.