How do you merge in GIT on Windows?

前端 未结 5 990
天命终不由人
天命终不由人 2020-12-07 12:39

I tried to use GIT however for me the biggest problem with it is that there is no tool for merge\'ing. At least the msysgit does not give me anything. How can I merge in GIT

相关标签:
5条回答
  • 2020-12-07 13:11

    You don't actually need another tool specifically for merging, since any decent Git provider should be able to take care of that, even msysgit itself. In your case where a GUI like WinMerge is desirable, there is EGit, which is the Git team provider for Eclipse, although its merge function can be somewhat unstable since the project is still relatively new. There is also TortoiseGit which I use for most git operations on Windows inclusive of merge.

    0 讨论(0)
  • 2020-12-07 13:13

    Kdiff3 is a great merge tool that I like to use in combination with git.

    http://www.mainelydesign.com/blog/view/using-kdiff3-as-git-gui-merge-tool-on-windows-xp-windows-7

    0 讨论(0)
  • 2020-12-07 13:19

    I suggest kdiff3. Install it and put something like:

    [merge]
            tool = kdiff3
    [mergetool "kdiff3"]
            path = c:/Program Files (x86)/KDiff3/kdiff3.exe
    [diff]
            tool = kdiff3
            guitool = kdiff3
    [difftool "kdiff3"]
            path = c:/Program Files (x86)/KDiff3/kdiff3.exe
    

    in your .gitconfig

    To edit the global config (.gitconfig): git config --global --edit

    The installation path on your machine may be different from c:/Program Files (x86)/KDiff3/kdiff3.exe. Replace that string above with actual path to your kdiff3 binary. And don't forget you have to use forward slashes, /, and not backward ones (\) like native programs usually do.

    0 讨论(0)
  • 2020-12-07 13:25

    Since you mention you use Eclipse, you can use EGit's merge tools, which provides a convenient way to handle conflicts:

    enter image description here

    enter image description here

    0 讨论(0)
  • 2020-12-07 13:34

    For me (windows xp, kdiff3 0.9.96 and git 1.7.5.1), Jan Hudec's answer did not work. Here is my setup:

    [diff]
            tool = kdiff3
            guitool = kdiff3
    
    [difftool]
            prompt = false
    
    [difftool "kdiff3"]
            path = /home/username/bin/difftool-kdiff3.sh
    

    and

    #!/bin/sh
    
    # Passed the following parameters from git
    #  --auto --L1 "somefile (A)" --L2 "somefile (B)" /tmp/4VhUw0_somefile somefile
    
    LOCAL=$6
    REMOTE=$7
    
    "C:/Program Files/KDiff3/kdiff3.exe" $(cygpath -w "$LOCAL") "$REMOTE"
    
    0 讨论(0)
提交回复
热议问题