简体   繁体   English

当我没有做出任何改变时,如何在git交互式rebase中发生冲突?

[英]How can there be conflicts in a git interactive rebase when I haven't made any changes?

I wanted to reword a commit in git so I did a git rebase -i 00112233 or something similar and I get merge conflicts without making any changes to the commits that will be applied. 我想在git中改写一个提交,所以我做了一个git rebase -i 00112233或类似的东西,我得到了合并冲突,而没有对将要应用的提交进行任何更改。 I enter the merge command, the editor pops up, I accept what's there and there's a merge conflict. 我输入合并命令,弹出编辑器,我接受那里有什么,并且存在合并冲突。

My understanding of git rebase -i is that HEAD is set to 00112233 and then the commits after 00112233 (which are already consistent since they've been applied to get to the current state) are applied in the order specified in the editor (which I haven't changed in this case). 我对git rebase -i理解是将HEAD设置为00112233 ,然后在00112233之后的提交(由于它们已应用于当前状态已经一致) 00112233编辑器中指定的顺序应用(我在这种情况下没有改变)。 I can't figure out how that process would lead to a merge conflict. 我无法弄清楚这个过程将如何导致合并冲突。

What are any ways such a situation can occur? 这种情况会发生什么?

If the history in question is not linear, you may have to reapply the conflict resolution you employed when you first merged. 如果相关历史记录不是线性的,则可能必须重新应用首次合并时使用的冲突解决方案。 To iilustrate, if history is: 如果历史是:iiustrate

C:\Temp\TestRepo>git log --graph  --oneline
*   3fc0537 Merge branch 'branch'
|\
| * 79e29f9 branch
* | 0de3658 master
|/
* edead94 Initial revision

And the merge commit 3fc0537 contained a conflict: 并且合并提交3fc0537包含冲突:

C:\Temp\TestRepo>git log -1
commit 3fc053701a53a30a01469f560ad5057eab74d126
Merge: 0de3658 79e29f9
Author: Edward Thomson <ethomson@edwardthomson.com>
Date:   Thu Feb 6 17:55:59 2014 -0800

    Merge branch 'branch'

    Conflicts:
        file.txt

Then rebasing off edead94 will produce a merge conflict. 然后重新edead94将产生合并冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM