git rebase 反复要求我运行 `git rebase --continue`

标签 git git-rebase

我在我的功能分支 my-feature ,我运行 rebase develop 分支:

(my-feature)$ git rebase develop

终端显示一堆冲突,在detached现在模式:
(detached*)$

我以分离模式解决了这些冲突并提交了它们。然后,我运行 git rebase --continue ,但现在 git 再次提示我以下内容:
(detached*)$ git rebase --continue
Applying: my-feature my commit message
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

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

所以,我再次运行 git rebase --continue ,但同样的消息向我显示,只要我运行 git rebase --continue 就无穷无尽.为什么?那么,在我解决了冲突以 rebase 来开发分支后,我应该怎么做?

最佳答案

在 rebase 上解决冲突时,您 不应该提交 他们,让 rebase 处理提交部分*。

*除非您处于交互式 rebase 中,否则您可以停止修改提交。

一旦你编辑了冲突的文件,你必须添加它们,然后提交,只有这样你才能git rebase --continue .下面是一个例子:

git rebase develop
# conflict
vi file-with-conflict
git add file-with-conflict
git rebase --continue

这将继续 rebase 到下一步(下一次提交),如果有新的冲突,你将不得不以同样的方式解决它。依此类推,直到既没有要解决的冲突也没有 promise rebase 。

在您的情况下,您可能需要先 git rebase --abort得到一个干净的石板,然后再次尝试 rebase 。

关于git rebase 反复要求我运行 `git rebase --continue`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57412780/

相关文章:

git - 解决 git merge octopus 上的冲突

git - 如何在提交到分支时触发 Jenkins 管道?

git - git rebase没有应用提交

git - rebase 废墟 merge

git - 如何使用散列而不是分支名称进行 git rebase?

git - 如何使用 master 上的上游更改更新主题分支?

带参数的 Git 别名

git - 在不使用反向补丁的情况下从分支中删除旧的 Git 提交?

git - 使用 Sourcetree 取消 merge Git 中的分支

git 从 pull 请求中删除提交