How do I view 'git diff' output with my preferred diff tool/ viewer?

后端 未结 26 2239
清酒与你
清酒与你 2020-11-22 03:20

When I type git diff, I want to view the output with my visual diff tool of choice (SourceGear \"diffmerge\" on Windows). How do I configure git to do this?

26条回答
  •  不要未来只要你来
    2020-11-22 04:04

    With new git difftool, its as simple as adding this to your .gitconfig file:

    [diff]
        tool = any-name
    [difftool "any-name"]
        cmd = "\"C:/path/to/my/ext/diff.exe\" \"$LOCAL\" \"$REMOTE\""
    

    Optionally, also add:

    [difftool]
        prompt = false
    

    Also check out diffall, a simple script I wrote to extend the annoying (IMO) default diff behaviour of opening each in serial.

    Global .gitconfig on Windows is in %USERPROFILE%\.gitconfig

提交回复
热议问题