【发布时间】:2012-07-16 15:27:40
【问题描述】:
我正在使用git version 1.7.11.msysgit.0
我在 Github 下创建了一个存储库,并添加了一个名为 README.md 的文件,其中包含一些文本内容。
后来,我安装了 GIT 客户端,做了一个克隆以将服务器内容放到我的机器上。
然后我将文件 README.md 删除到我的本地机器上。
现在当我执行 git commit 时,我得到了这个错误
praveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING)
$ git commit ;
U README.md
error: 'commit' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: Exiting because of an unresolved conflict.
这是git pull:
$ git pull;
U README.md
A One.txt
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
如何解决这些错误?
【问题讨论】:
-
所以当你在 Github 上创建一个 repo 并选中
Initialize this repository with a README选项时会发生这种情况。因此,最简单的解决方案是不检查该选项。 Else 从 Github 克隆远程仓库,而不是在本地机器上创建新仓库。 Else 按照错误消息的说明进行操作,它也会为您找到解决方案。 :) -
那么,运气好吗?如果您接受其中一个答案,请将其标记为接受。
-
CodeGnome,“我是 git 新手”有什么不清楚的地方?
-
该错误消息的显示现在在 git 2.1(2014 年 8 月)中发生了变化。见my answer below
标签: git github git-commit git-pull