git pull --rebase with auto merge strategy 不起作用

git pull --rebase with auto merge strategy not working

我正在尝试使用自动合并策略来拉动变基,

m-hissain-sk01:sc hissain$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 47 and 3 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

error: could not apply b5f4d22... Refactored existing source
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply b5f4d22... Refactored existing source

m-hissain-sk01:sc hissain$ git status
interactive rebase in progress; onto 2d4593d
Last command done (1 command done):
   pick b5f4d22 Refactored existing source
Next commands to do (2 remaining commands):
   pick 4298398 Implemented clean swift version
...

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)

    added by us:     MyProj.xcodeproj/project.xcworkspace/contents.xcworkspacedata
    added by us:     MyProj.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
    added by us:     MyProj/Configs/Assets.xcassets/AppIcon.appiconset/Contents.json
        ...

我们的版本会自动解决预期的冲突。但是在 运行 命令之后,我仍然看到未隐藏的代码等待手动解析。

为什么没有成功?

你的输出中缺少 rebase 的开头,但我强烈怀疑有以下形式的消息:

CONFLICT (add/add): ...

或:

CONFLICT (rename/delete): ...

在其他各种消息中。当您指定 -X ours (至少根据原始问题文本)时:

git pull --rebase -X ours

-X ours 仅自动解决 some 冲突,而不是 all 冲突。特别是,它不能解决我所说的 高级别 冲突,例如 add/add 或 rename/delete 冲突。

此时您必须做的是完成合并操作并使用 git rebase --continue 继续变基,或者使用 git rebase --abort 中止整个变基操作。请记住,git pull 仅为您运行 两个 Git 命令:

  1. git fetch,然后
  2. (如果成功),git mergegit rebase,参数由步骤 1 中获取的内容决定。

您在第 2 步中调用的 git rebase 不完整。 (我寻找了一些关于如何解决此类合并的 SO 答案——我知道它们存在——但还没有找到 link 的任何好的答案。)编辑:这是 add/add 的一个:Resolving a 'both added' merge conflict in git?