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

后端 未结 26 2227
清酒与你
清酒与你 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 03:52

    Install meld

     # apt-get install meld
    

    Then choose that as difftool

     $ git config --global diff.tool meld
    

    If tou want to run it on console type:

     $ git difftool
    

    If you want to use graphic mode type:

     $ git mergetool
    

    And the output would be:

     'git mergetool' will now attempt to use one of the following tools:
     meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse
     diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff
     Merging:
     www/css/style.css
     www/js/controllers.js
    
     Normal merge conflict for 'www/css/style.css':
       {local}: modified file
       {remote}: modified file
     Hit return to start merge resolution tool (meld):
    

    So just press enter to use meld(default), this would open graphic mode, make the magic save and press that that resolve the merge. That's all

提交回复
热议问题