git mergetool 报告“没有文件需要合并”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7854611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git mergetool reports "No files need merging"
提问by Christopher Pickslay
For some reason lately, every time I pull and get a merge conflict, running git mergetool
reports "No files need merging":
最近出于某种原因,每次我拉并遇到合并冲突时,都会运行git mergetool
报告“没有文件需要合并”:
$ git pull
First, rewinding head to replay your work on top of it...
Applying: replaced home button with Cancel
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: Your local changes to the following files would be overwritten by merge:
Classes/Controllers/HomeController.m
Please, commit your changes or stash them before you can merge.
Aborting
Failed to merge in the changes.
Patch failed at 0002 moved rollback into cancel button in log watching
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
$ git mergetool
No files need merging
If I run git rebase --abort
and pull again, either the same thing happens on a different conflict, or the pull succeeds with no merge conflict. There are no remote changes between these pulls, so it's not as though the conflict went away.
如果我git rebase --abort
再次运行并拉动,要么在不同的冲突中发生同样的事情,要么拉动成功而没有合并冲突。这些拉动之间没有远程变化,因此冲突并没有消失。
Here's how this branch and the remote are configured:
以下是此分支和远程的配置方式:
[branch "develop"]
remote = origin
merge = refs/heads/develop
rebase = true
[remote "origin"]
url = <my repo url>
fetch = +refs/heads/*:refs/remotes/origin/*
采纳答案by Christopher Pickslay
It looks like my problem had to do with file timestamps. Thanks to this SO answersuggested by Mark Longair, the following setting fixed it for me:
看起来我的问题与文件时间戳有关。感谢Mark Longair 建议的这个 SO 答案,以下设置为我修复了它:
git config --global core.trustctime false
回答by Josh
回答by IProblemFactory
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.
这对我有用:Git 在冲突文件所在的同一目录中创建了一些与合并相关的文件,因此请记住git mergetool
在正确的路径中运行。
回答by lijinma
Solution 1:
解决方案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.
如果为 false,则忽略索引和工作副本之间的 ctime 差异;当 inode 更改时间被 Git 之外的东西(文件系统爬虫和一些备份系统)定期修改时很有用。并且 core.trustctime 默认为真。
Solution 2: just:
解决方案2:只需:
$git rebase --skip
It's OK for you to skip it
你可以跳过它
回答by Adam Dymitruk
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 更擅长解决冲突。不能太自以为是。例如,Beyond Compare 具有语法意识,可以为您做很多事情。如果配置正确,则只需编译并运行解决方案即可进行测试。如果一切顺利,那么就git add -A
和git rebase --continue
。你遇到的情况是正常的。仔细检查您的“信任合并工具退出代码”设置:
git config --global mergetool.trustExitCode true
Note: the -A option in git add
will stage all changes including deletions and new, untracked files.
注意: -A 选项git add
将暂存所有更改,包括删除和新的未跟踪文件。
回答by TrueWill
In my case the issue was that I had another console window open and was running the application (based on create-react-app, with hot reloading) in that window.
就我而言,问题是我打开了另一个控制台窗口并在该窗口中运行应用程序(基于 create-react-app,带有热重载)。
Killing the process and closing the other window, then aborting the rebase and retrying worked for me.
终止进程并关闭另一个窗口,然后中止变基并重试对我有用。
回答by mitch
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.
难道你必须先运行合并?然后如果有合并冲突需要解决,你可以运行mergetool。但是,直到由于不完整合并的结果而创建之前,我认为 mergetool 只会报告没有要合并的内容。