git visual diff between branches

前端 未结 16 2001
独厮守ぢ
独厮守ぢ 2020-12-12 08:35

This answer is great for seeing a visual diff between two files that are checked into git: How do I view 'git diff' output with a visual diff program?

Howev

16条回答
  •  温柔的废话
    2020-12-12 09:35

    You can use the free P4Merge from Perforce to do this as well:

    http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools

    Details on integrating it with Git can be found here and here

    but a quick summary from the above links is:

    • Put the following bits in your ~/.gitconfig, and then you can do $ git mergetool and $ git difftool to use p4merge
    • Note that $ git diff will still just use the default inline diff viewer :) (tested with git version 1.8.2)

    Changes for .gitconfig

    [merge]
      keepBackup = false
        tool = p4merge
    [mergetool "p4merge"]
        cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
        keepTemporaries = false
        trustExitCode = false
        keepBackup = false
    [diff]
        tool = p4merge
    [difftool "p4merge"]
        cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$REMOTE\"" "\"$LOCAL\""
    

提交回复
热议问题