【发布时间】:2021-08-02 22:20:51
【问题描述】:
我真的是 Git 新手,我正在尝试更新我的分支以匹配主分支,因为我需要将更改下载到我的分支,所以我在当前的工作场所。我试着做git pull origin master --rebase 但它说
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
我不确定该怎么做,我不想意外删除文件或擦除整个 repo。
【问题讨论】:
-
您是否尝试添加未合并的文件?错误信息非常明确,你有什么困惑?
-
记住
git pull的意思是:首先,运行git fetch,然后运行第二个Git 命令来处理获取的提交。默认的第二个命令是git merge。所以git pull运行git fetch,然后运行git merge。由于冲突,合并操作可以在中间停止,当它发生时,您不能运行另一个合并,因为还有一个仍在进行。可能您已经运行了git pull,它在合并过程中停止了。然后你再次运行git pull,这一次它甚至不会开始合并,因为还有一个停止的要先完成。 -
在上面的示例中,您使用了
git pull --rebase。这会将 second 命令从git merge更改为git rebase。但是,rebase 具有相同的“可以在中间停止”的行为,因此也有同样的抱怨。
标签: git