在使用 git rebase 重新排列和操作提交后,如果出现合并冲突,Git 会在终端打印以下信息来提示你。
error: could not apply fa39187... something to add to patch A
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".
Could not apply fa39187f3c3dfd2ab5faa38ac01cf3de7ce2e841... Change fake file
这里,Git 告诉你是哪次提交导致冲突(fa39187)。你有三种选择:
- 你可以运行
git rebase --abort完全撤销 rebase。Git 会把你的分支恢复到调用git rebase之前的状态。 - 你可以运行
git rebase --skip完全跳过该提交。这意味着问题提交引入的所有更改都不会被包含。很少会选择此选项。 - 你可以解决冲突。
要解决冲突,你可以遵循 命令行解决合并冲突的标准流程。完成后,需要调用 git rebase --continue,让 Git 继续处理其余的 rebase。