Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git:将问题与Git合并_Git_Github_Git Commit_Git Pull - Fatal编程技术网

Git:将问题与Git合并

Git:将问题与Git合并,git,github,git-commit,git-pull,Git,Github,Git Commit,Git Pull,我使用的是git版本1.7.11.msysgit.0 我在GitHUB下创建了一个存储库,并添加了一个名为README.md的文件,其中包含一些文本内容 后来,我安装了GIT客户端,做了一个克隆,将服务器内容放到我的机器上 然后我删除了本地机器上的README.md文件 现在,当我执行git提交时,我得到了这个错误 praveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING) $ git commit ; U README

我使用的是git版本1.7.11.msysgit.0

我在GitHUB下创建了一个存储库,并添加了一个名为README.md的文件,其中包含一些文本内容

后来,我安装了GIT客户端,做了一个克隆,将服务器内容放到我的机器上

然后我删除了本地机器上的README.md文件

现在,当我执行git提交时,我得到了这个错误

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 merge --abort
git pull (to be sure you're up-to-date)
现在,将README.md文件的内容替换为您想要的内容。如果您根本不想要它,请使用git rm README.md

然后,如果替换了这些内容,请使用以下内容提交并推送这些内容:

git add README.md
git commit -m "comment"
git push
尝试:


我有一个类似的问题,这是唯一解决它的方法。

虽然git reset是一个很好的解决方案,但请注意,警告消息现在有了更好的格式(git 2.12014年8月)

见和,作者:

不规则的换行使得阅读起来很困难,而且它占用的行数超过了需要的行数。相反,让我们将其改写为每行大约60个字符。
commit
”周围的引号很粗;用户不关心此消息是否是已填入命令名的模板

$ git commit
U       foo
error: commit 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, or use
hint: 'git commit -a'.
fatal: Exiting because of an unresolved conflict.
$git提交
乌福
错误:无法提交,因为您有未合并的文件。
提示:在工作树中修复它们,然后使用“git add/rm”
提示:根据需要标记解析并进行提交,或使用
提示:“git提交-a”。
致命:由于未解决的冲突而退出。

浏览器会请求图像,即使它们的“显示”属性设置为“无”。
为了防止出现这种情况,您可以实现我前面提到的解决方案,但是如果您要过度切换图像的可见性,使用display:none属性可以避免在HTML中添加和删除图像会带来不必要的性能成本。

因此,当您在Github上创建repo时,选中选项
使用自述文件初始化此存储库时,就会发生这种情况。因此,最简单的解决方案是不检查该选项。否则从Github克隆远程repo,而不是在本地计算机中创建新的repo。否则,请按照错误消息所述进行操作,它也会为您找到解决方案。:)那么,运气好吗?如果您接受其中一个答案,请将其标记为so.CodeGnome,关于“我对git是新手”还有什么不清楚的地方?该错误消息的呈现方式现在在git 2.1(2014年8月)中有所改变。请参见
git merge--abort
然后
git pull
然后
git prune
。我运行了这些命令,在git pull origin master——allow unrelated Histories——这是唯一对我有效的解决方案之后,一切都得到了解决。我只是厌倦了mergetool,而实际上我只做了一行更改。(尽管我多次选择让mergetool知道我的选择(B),但它从未将其标记为已解决)
 git reset README.md
$ git commit
U       foo
error: commit 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, or use
hint: 'git commit -a'.
fatal: Exiting because of an unresolved conflict.