git mergetool reports “No files need merging”

前端 未结 7 1000
傲寒
傲寒 2020-12-05 12:57

For some reason lately, every time I pull and get a merge conflict, running git mergetool reports \"No files need merging\":

$ git pull
First, r         


        
相关标签:
7条回答
  • 2020-12-05 13:19

    Merge tools are better at resolving conflicts than stock git. It can't be too opinionated. For example Beyond Compare is syntax aware and will do a lot for you. If you have it configured right, you can just compile and run your solution to test. If it's all good, then just git add -A and git rebase --continue. What you are experiencing is normal. Double check your "trust mergetool exit code" setting:

    git config --global mergetool.trustExitCode true
    

    Note: the -A option in git add will stage all changes including deletions and new, untracked files.

    0 讨论(0)
  • 2020-12-05 13:24

    It looks like my problem had to do with file timestamps. Thanks to this SO answer suggested by Mark Longair, the following setting fixed it for me:

    git config --global core.trustctime false
    
    0 讨论(0)
  • 2020-12-05 13:25

    This fixed it for me:
    git mergetool .

    I found this fix here

    0 讨论(0)
  • 2020-12-05 13:27

    Solution 1:

    $git config --global core.trustctime false
    

    If false, the ctime differences between the index and the working copy are ignored; useful when the inode change time is regularly modified by something outside Git (file system crawlers and some backup systems). and core.trustctime is true by default.

    Solution 2: just:

    $git rebase --skip
    

    It's OK for you to skip it

    0 讨论(0)
  • 2020-12-05 13:28

    Could it be that you must first run merge? Then if there are merge conflicts to resolve, you can run mergetool. But until there are created as the results of an incomplete merge, I think mergetool will simply report there is nothing to merge.

    0 讨论(0)
  • 2020-12-05 13:40

    Trivial solution

    which worked for me: Git creates some merge related files in the very same directory where the conflicted file is, so remember to run git mergetool in correct path.

    0 讨论(0)
提交回复
热议问题