由于某些原因,最近每次拉动并发生合并冲突时,运行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
Run Code Online (Sandbox Code Playgroud)
如果我git rebase --abort
再次运行和拉动,则在不同的冲突上发生相同的事情,或者拉动成功而没有合并冲突.这些拉动之间没有任何远程变化,因此冲突并没有消失.
以下是此分支和远程配置的方式:
[branch "develop"]
remote = origin
merge = refs/heads/develop
rebase = true
[remote "origin"]
url = <my repo url>
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
Chr*_*lay 16
看起来我的问题与文件时间戳有关.感谢Mark Longair建议的这个答案,以下设置为我解决了这个问题:
git config --global core.trustctime false
Run Code Online (Sandbox Code Playgroud)
解决方案1:
$git config --global core.trustctime false
Run Code Online (Sandbox Code Playgroud)
如果为false,则忽略索引与工作副本之间的ctime差异; 当gode(文件系统爬虫和一些备份系统)之外的某些东西定期修改inode更改时间时非常有用.和core.trustctime默认为true.
解决方案2:只是:
$git rebase --skip
Run Code Online (Sandbox Code Playgroud)
您可以跳过它