繁体   English   中英

由于未合并的文件而无法进行git pull

[英]Can't git pull because of unmerged files

我对git还是很陌生,试图弄清楚一切如何工作。 所以这是我的情况:我一直在笔记本电脑上从事Java项目。 推送到git存储库,并将其拉到另一台机器上。 进行一些更改并将其推送到存储库中。 现在,我想将当前的工作放到笔记本电脑上,但是我不能,因为我没有合并文件。

Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'

请帮助纠正此问题。 谢谢。

$ git status
on branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

You have unmerged paths.
  (fix conflicts and run "git commit")

您有两种选择:完成当前合并或中止合并。

  1. 要完成合并,您首先需要检查要合并的文件。 你可以这样做

     git status 

    现在,编辑文件以解决所有合并冲突。 当您对将代码还原到工作状态感到满意时,应运行

     git add . git commit 
  2. 另一方面,如果要中止当前合并并删除所有本地更改,则可以执行

     git reset --hard HEAD 

    警告此命令要非常小心。 它将删除所有本地更改,并且您将无法还原它们。

最后,当您完成上述任何一个动作后,就可以继续进行拉动。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM