首页 > 解决方案 > 解决拉入 Atom 的冲突

问题描述

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

解决冲突后,我陷入困境。我尝试了“创建分离提交”,但如何继续?当我回到 master 并 push 时,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。在这里,我还收到消息“似乎……”。在分离分支上做git rebase --continue时,我再次得到“没有变化 - 你......”。

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

重现步骤:

  1. 在两个不同的目录 D1 和 D2 中克隆一个新项目
  2. 创建带有文本“ab”的文本文件
  3. 在目录 D1 和 D2 中拉取这个
  4. 在 D2 中将 ""更改ab为 " a_b_" 并使用 'make b cursive' 提交
  5. 在 D2 中将 " "更改a_b_为 " a**_b_**" 并使用 'make b bold' 提交
  6. 推送更改
  7. 在 D1 中将“”更改ab为“ _a_b”并使用“制作草书”提交
  8. 将 D1 中的 " "更改_a_b为 " **_a_**b" 并使用 'make a bold' 提交
  9. 推送更改
  10. 因冲突而拉
  11. 解决冲突,使结果文本为“ **_a_****_b_**
  12. 现在我被困在上面的文字中

标签: gitatom-editor

解决方案


没有变化 - 你忘记使用 '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”格式的历史记录

推荐阅读