What's the best visual merge tool for Git?

What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel.

Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't give me an error.)

My OS is Ubuntu.


Meld is a diff/merge tool.

Here's how to install it on:

  • Ubuntu
  • Mac
  • Windows: "The recommended version of Meld for Windows is the most recent release, available as an MSI from http://meldmerge.org"

  • You can configure your own merge tool to be used with " git mergetool ".

    Example:

      git config --global merge.tool p4merge
      git config --global mergetool.p4merge.cmd p4merge '$BASE $LOCAL $REMOTE $MERGED'
      git config --global mergetool.p4merge.trustExitCode false
    

    And while you are at it, you can also set it up as your difftool for " git difftool ":

      git config --global diff.tool p4merge
      git config --global difftool.p4merge.cmd p4merge '$LOCAL $REMOTE'
    

    Note that in Unix/Linux you don't want the $BASE to get parsed as a variable by your shell - it should actually appear in your ~/.gitconfig file for this to work.


    Beyond Compare 3 , my favorite, has a merge functionality in the Pro edition. The good thing with its merge is that it let you see all 4 views: base, left, right, and merged result. It's somewhat less visual than P4V but way more than WinDiff. It integrates with many source control and works on Windows/Linux. It has many features like advanced rules, editions, manual alignment...

    The Perforce Visual Client (P4V) is a free tool that provides one of the most explicit interface for merging (see some screenshots). Works on all major platforms. My main disappointement with that tool is its kind of "read-only" interface. You cannot edit manually the files and you cannot manually align.

    PS: P4Merge is included in P4V. Perforce tries to make it a bit hard to get their tool without their client.

    SourceGear Diff/Merge may be my second free tool choice. Check that merge screens-shot and you'll see it's has the 3 views at least.


    Meld is a newer free tool that I'd prefer to SourceGear Diff/Merge: Now it's also working on most platforms (Windows/Linux/Mac) with the distinct advantage of natively supporting some source control like Git. So you can have some history diff on all files much simpler. The merge view (see screenshot) has only 3 panes, just like SourceGear Diff/Merge. This makes merging somewhat harder in complex cases.

    PS: If one tool one day supports 5 views merging , this would really be awesome, because if you cherry-pick commits in Git you really have not one base but two. Two base, two changes, and one resulting merge.

    链接地址: http://www.djcxy.com/p/7232.html

    上一篇: 在Windows上的Git:你如何设置一个mergetool?

    下一篇: 什么是Git最好的视觉合并工具?