Using p4merge as git diff tool

后端 未结 2 1847
有刺的猬
有刺的猬 2021-02-15 10:19

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:

<         


        
相关标签:
2条回答
  • 2021-02-15 11:07

    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 p4merge is in this list then you just need to add the path where p4merge.exe resides 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 .gitconfig

    [diff]
        tool = p4merge
    [merge]
        tool = p4merge
    

    and nothing else. So remove other stuff like difftool.path and all that.

    Then just use git difftool or git mergetool to your hearts content.

    Note: I had a repository in which even if I did issue the git difftool or git mergetool commands 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 with git init, add a file, commit it, then modify it, then I tried difftool and it worked. So if the above description doesn't work for you chances the problem lies somewhere else. Hope this helps.

    0 讨论(0)
  • 2021-02-15 11:14

    Better late than never :)

    mergetool.p4merge.path should be mergetool.p4merge.cmd

    Change path to cmd for both the mergetool and difftool lines.

    0 讨论(0)
提交回复
热议问题