"拉不可能,因为你有未合并的文件" - 我该如何解决?

时间:2016-08-04 17:27:32

标签: git

我在这个网站上发现了一些类似的问题,但事实是我几乎不知道自己在做什么,也无法跟上答案。

我正在尝试将员工添加到我公司的网站。我写的时候

$ git pull origin gh-pages

它出现了所有这些:

Laurences-MacBook-Pro-2:opennorth.ca Laurence$ git pull origin gh-pages
M   _data/staff.yml
M   _layouts/default.html
D   _posts/2013-04-05-this-week-in-open-government.md
A   _posts/2016-04-11-open-north-newsletter-spring-2016.md
A   _posts/2016-05-05-launching-and-sustaining-municipal-open-data-initiatives-how-open-north-can-help.md
A   _posts/2016-06-01-open-cities-strategies-a-new-initiative-by-open-north-to-help-cities-succeed-in-planning-and-implementing-their-open-data-programs.md
A   _posts/2016-06-08-spreading-the-word-about-citizen-budget-our-innovative-online-budget-simulator.md
A   _posts/2016-06-15-applied-research-in-action-immigration-refugee-and-citizenship-canada.md
A   _posts/2016-07-07-exploring-the-social-sector-s-relationship-with-data-takeaways-from-data-4-impact.md
M   index.html
U   theme
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 and make a commit.
Laurences-MacBook-Pro-2:opennorth.ca Laurence$ 

这些是博客文章,其他员工(也对Github知之甚少)一直通过Prose.io发布。我认为她错过了将文件合并到原始分支的某种步骤?

我不想删除所有这些帖子,但我不知道如何在工作树中修复它们。

非常赞赏任何以超级拉面术语提供的帮助。

以下是git status的结果:

On branch gh-pages
Your branch and 'origin/gh-pages' have diverged,
and have 1 and 65 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
You have unmerged paths.
  (fix conflicts and run "git commit")

Changes to be committed:

    modified:   _data/staff.yml
    modified:   _layouts/default.html
    deleted:    _posts/2013-04-05-this-week-in-open-government.md
    new file:   _posts/2016-04-11-open-north-newsletter-spring-2016.md
    new file:   _posts/2016-05-05-launching-and-sustaining-municipal-open-data-initiatives-how-open-north-can-help.md
    new file:   _posts/2016-06-01-open-cities-strategies-a-new-initiative-by-open-north-to-help-cities-succeed-in-planning-and-implementing-their-open-data-programs.md
    new file:   _posts/2016-06-08-spreading-the-word-about-citizen-budget-our-innovative-online-budget-simulator.md
    new file:   _posts/2016-06-15-applied-research-in-action-immigration-refugee-and-citizenship-canada.md
    new file:   _posts/2016-07-07-exploring-the-social-sector-s-relationship-with-data-takeaways-from-data-4-impact.md
    modified:   index.html

Unmerged paths:
  (use "git add <file>..." to mark resolution)

    both modified:   theme

Laurences-MacBook-Pro-2:opennorth.ca Laurence$ 

谢谢! 劳伦斯

2 个答案:

答案 0 :(得分:2)

当你的git repo中有一些未被“保存”的变化时,你无法进行像git pull这样的破坏性操作 - 否则,你将失去你目前所做的所有事情!

你可以在这里做两件事之一:

  • 通过运行git stash
  • 保存现有更改以供日后使用
  • 提交并保存现有更改,例如:git add --all; git commit

完成其中任何一项操作后,您就可以按照自己的意愿进行分支更改。

答案 1 :(得分:0)

如果您所做的更改相对较小,最简单的方法可能是首先存储您的更改,然后执行拉动,然后重新应用存储。此时,您可以解决任何冲突。

Index