git mergetool为什么说“不需要合并文件"? [英] why does git mergetool say "No files need merging"?

查看:100
本文介绍了git mergetool为什么说“不需要合并文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将BeyondCompare4配置为git中的difftool和mergetool.我正在使用git版本2.5.0.windows.1.到目前为止,BeyondCompare4可以作为difftool很好,但不能作为mergetool.

I'm trying to configure BeyondCompare4 as my difftool and mergetool in git. I'm using git version 2.5.0.windows.1. So far BeyondCompare4 is working just fine as a difftool but not as a mergetool.

从我的master分支运行git mergetool branch3,它以No files need merging

From my master branch I run git mergetool branch3 and it responds with No files need merging

但是当我运行git diff branch3时,我可以在一个文件中看到几种类型的差异(通常在同一行).如果我只运行git merge branch3,它将启动合并过程并以CONFLICT停止.那么git mergetool为什么不以同样的方式为我工作?

But when I run git diff branch3 I can see several types of differences in one file (often on the same line). And if I just run git merge branch3 it does start the merge process and stop with a CONFLICT. So why doesn't git mergetool work for me in the same way?

此链接建议git config --global core.trustctime false,但我没有运气尝试过: git mergetool报告无需合并文件"

This link suggested git config --global core.trustctime false which I tried with no luck: git mergetool reports "No files need merging"

此链接建议rerere可能是一个问题,所以我也尝试了git config --global rerere.enabled false,但也没有运气: git告诉我合并冲突,但也告诉我不需要合并文件

This link suggested rerere may be a problem so I tried git config --global rerere.enabled false also with no luck: git tells me that I Merge conflict, but also tells me that no files need merging

这是我的.gitconfig的样子:

This is what my .gitconfig looks like:

[diff]
    tool = bc
[difftool]


    prompt = false
[difftool "bc"]
    trustExitCode = true
    cmd = 'c:/program files (x86)/beyond compare 4/bcomp.exe' $LOCAL $REMOTE


[merge]
    tool = bc
[mergetool]
     prompt = false
[mergetool "bc"]
    trustExitCode = true
    cmd = 'c:/program files (x86)/beyond compare 4/bcomp.exe' $LOCAL $REMOTE $BASE $MERGED

我什至尝试修改.gitconfig来将bcomp4.exe路径更改为伪造的东西,只是为了查看是否会出现错误.如果我对difftool进行更改,则会遇到有关系统找不到路径的错误.但是,如果我在mergetool上进行更改,它只会说不需要合并文件",这使我相信BeyondCompare4甚至都没有运行.

I even tried modifying .gitconfig to change the bcomp4.exe path to something bogus just to see if I could get an error. If I make the change to difftool I get errors about the system not finding the path. But if I change it on the mergetool it just keeps saying "No files need merging" which leads me to believe BeyondCompare4 is not even running.

感谢任何想法,为什么git mergetool会因该消息而提前停止.

Thanks for any ideas why git mergetool is stopping early with that message.

推荐答案

当您处于需要解决冲突的状态(即合并导致冲突之后)时,应使用git mergetool.

You should use git mergetool when you are in a state where you need to resolve conflicts, that is, after a merge results in a conflict.

git checkout master
git merge branch3
# the merge reports conflicts which we need to resolve
git mergetool
git add -u
git commit -m "a merge commit message"

有关使用meregetool解决冲突的更多信息,请访问 https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts

More about resolving conflicts with meregetool can be found at https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#Basic-Merge-Conflicts

请咨询git help mergetool以获取选项.

这篇关于git mergetool为什么说“不需要合并文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆