Which version of the git file will be finally used: LOCAL, BASE or REMOTE?

前端 未结 8 1476
故里飘歌
故里飘歌 2020-11-28 17:39

When there\'s a collison during git merge, I open a mergetool called Meld. It opens three files LOCAL, BASE and REMOTE. As I\'ve read LOCAL is my local branch,

8条回答
  •  甜味超标
    2020-11-28 18:04

    With Meld 1.7 the Solution by Tomek Bury does not work anymore.

    The default settings didn't satisfy me:

    Default settings

    Instead for Meld >=1.7 I suggest one of two other solutions.

    First solution:

     meld $LOCAL $BASE $REMOTE --auto-merge
    

    first solution

    Second solution:

     meld $LOCAL $MERGED $REMOTE
    

    second solution

    .gitconfig

    Copy & paste this in your .gitconfig file to get the solutions as described above:

    [merge]
        tool = meld16
    [mergetool "meld17"]
        # use this for Meld >=1.7
        # see http://stackoverflow.com/a/22911793/859591
        # second solution:
        cmd = meld $LOCAL $MERGED $REMOTE
        # first solution:
        #cmd = meld $LOCAL $BASE $REMOTE --auto-merge
    [mergetool "meld16"]
        cmd = meld --diff $BASE $LOCAL --diff $BASE $REMOTE --diff $LOCAL $BASE $REMOTE --output $MERGED
    
    [include]
        # requires git v1.7.10+
        path = .gitconfig.local
    

    Copy & paste this in a .gitconfig.local file to set meld17 or meld16 only for this machine in case you use your .gitconfig on multiple machines:

    # This is a host specific config file!
    # Note that git 1.7.10+ is needed
    # http://stackoverflow.com/a/9733277/859591
    [merge]
        tool = meld17
    

提交回复
热议问题