【问题标题】:Why does `git rebase --continue` fail with gitmodules error?为什么 `git rebase --continue` 会因 gitmodules 错误而失败?
【发布时间】:2015-07-02 10:36:18
【问题描述】:

我基于master创建了一个名为lab的分支。几个月后,我尝试基于 master 重新定义实验室分支。首先有一个 .gitignore 冲突;解决后,我运行了git rebase --continue,但又失败了,这次没有帮助信息告诉我如何继续这个变基。如何在 master 的基础上 rebase lab 分支?

git rebase --continue
Applying: start edit
Applying: a
fatal: mode change for .gitmodules, which is not in current HEAD
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0002 a
The copy of the patch that failed is found in:
   f:/testxxx/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

【问题讨论】:

    标签: git git-branch git-submodules


    【解决方案1】:

    .gitmodules 存在于一个分支上,而不存在于另一个分支上。查看补丁文件,看看哪个,然后使用 git add 或 git rm 来决定是否需要 .gitmodules 文件作为 rebase 的结果。

    【讨论】:

    • 我无法在 master 分支上删除 .gitmodules,因为我只能在自己的 fork 上进行修改,如果我在 master 分支上 rm .gitmodules,我就无法从远程 repo 中提取更新 :( 问题仍然存在如何基于 master 分支 rebase 我的实验室分支?
    【解决方案2】:

    尝试使用 --merge 修饰符运行 rebase

    git rebase --merge branchname
    

    【讨论】:

      猜你喜欢
      • 2016-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多