2016-08-04 61 views
1

我在這個網站上發現了一些類似的問題,但事實是,我幾乎不知道自己在做什麼,不能跟上答案。「拉不可能,因爲你有沒有合併的文件」 - 我該如何解決這個問題?

我正在嘗試將員工添加到我的公司網站。當我寫

$ 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的狀態結果:

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$ 

謝謝! 勞倫斯

+0

你可以發佈'git status'的結果嗎?您可以編輯您的原始問題發佈。評論部分可能太長了。 – Haozhun

+1

http://stackoverflow.com/questions/26376832/why-does-git-say-pull-is-not-possible-because-you-have-unmerged-files – DavidN

+0

我添加了git狀態的結果。是的,我看到了這個問題,但不幸的是答案對我來說絕對沒有意義:( –

回答

2

當你的git repo中有沒有'保存'的變化時,你不能做像git pull這樣的破壞性操作 - 否則,你會失去目前正在做的所有事情!

你可以做這裏的兩兩件事之一:

  • 要麼保存現有供以後改變運行git stash,或
  • 提交併保存現有的變化,例如:git add --all; git commit

完成這些操作之後,您就可以像您想要的那樣拉取分支更改。

+1

非常感謝!它的工作。 –

+0

或'git reset --hard'如果您不介意丟失您的更改。 – JDB

0

如果您在您身邊所做的更改相對較小,那麼最簡單的方法是首先保存您的更改,然後重新應用存儲。此時您可以解決任何衝突。

git stash 
git pull origin gh-pages 
git stash pop 
相關問題