解决拉入 Atom 时的冲突

Resolve conflict on pull in Atom

当我拉动并且 Atom 中存在冲突时,会创建带有冲突标记的文件和一个分离的分支。

解决冲突后,我卡住了。我试过了"Create detached commit",但是怎么办呢?当我回到 master 并按下 git 时,仍然说我当前分支的尖端在远程后面。当我拉时,它说

It seems that there is already a rebase-apply directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
    git rebase (--continue | --abort | --skip)
If that is not the case, please
    rm -fr "C:/Users/ststolz/git/test/.git/rebase-apply"
and run me again.  I am stopping in case you still have something
valuable there.

当我现在在命令行中尝试 git rebase --continue 时,git 说:

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.

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

我还尝试将分离分支变基为 master。在这里我也得到消息"It seems that ..."。在分离分支上执行 git rebase --continue 时,我再次得到 "No changes - did you ..."。

我应该如何在 Atom 中解决这个问题?我没有进一步的想法。

重现步骤:

  1. 在两个不同的目录 D1 和 D2 中克隆一个新项目
  2. 创建文本文件 "ab"
  3. 将其拉入目录 D1 和 D2
  4. 在 D2 中将“ab”更改为“a_b_”并使用 'make b cursive'
  5. 提交
  6. 在 D2 中将“a_b_”更改为“a**_b_**”并使用 'make b bold'
  7. 提交
  8. 推送更改
  9. 在 D1 中将“ab”更改为“_a_b”并使用 'make a cursive'
  10. 提交
  11. 在 D1 中将“_a_b”更改为“**_a_**b”并使用 'make a bold'
  12. 提交
  13. 推送更改
  14. 因为冲突拉
  15. 解决冲突,使结果文本为“**_a_****_b_**
  16. 现在我像上面的文字描述的那样卡住了

No changes - did you forget to use 'git add'?

您似乎已经解决了冲突,因此您删除了所有本地编辑。这是你真正的意思吗?如果是这样,则按照提示调用 git rebase --skip

编辑:根据您的描述 - 您正在变基 (?) 2 次提交 A1A2,它们编辑了 "a".

  • 首先只是把cusrive加到a上,结果有冲突
  • (我假设)在那一步你将其编辑为 **_a_****_b_**,添加并继续 变基,
  • git 记录第一次变基提交 A1' 第二次提交也有冲突
  • (我假设)您再次将文件编辑为 **_a_****_b_** 和 运行 git rebase --continue
  • 此处,file的内容与A1'中的内容相同,您得到消息"No changes..."
  • 你可以运行 git rebase --skip,跳过A2,因为你所有的更改都已经记录在commit A1'.
  • 或者,您可以重新启动 rebase,并将第一次提交仅解析为 _a_**_b_**,将第二次提交解析为 **_a_****_b_**,这样您就可以保留 "a" 格式化的历史记录