git pull --rebase自动合并策略不起作用

问题描述 投票:0回答:1

我正在尝试通过自动合并策略来拉大基础,

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
        ...

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

为什么不起作用?

git merge rebase conflict git-pull
1个回答
1
投票

您的输出中缺少rebase的开头,但是我强烈怀疑是否存在以下形式的消息:

CONFLICT (add/add): ...

或:

CONFLICT (rename/delete): ...

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

git pull --rebase -X ours

-X ours仅自动解决some冲突,而不解决all冲突。特别是,它不能解决我所说的high level冲突,例如添加/添加或重命名/删除冲突。

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

  1. [git fetch,然后
  2. (如果成功,则git mergegit rebase,其参数由在步骤1中获取的参数确定。

您在步骤2中调用的git rebase不完整。

© www.soinside.com 2019 - 2024. All rights reserved.