2013-02-07 23 views
6

當我的Git的狀態,我得到這個錯誤信息:混帳 - 奇怪的分支合併錯誤我不知道如何解決

# On branch master 
# Your branch and 'origin/master' have diverged, 
# and have 1 and 2 different commits each, respectively. 
# 
# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
# .gitignore 
nothing added to commit but untracked files present (use "git add" to track) 

所以我不能拉或推。當我拉我得到這個:

macoss-MacBook-Pro-10:Marketing owner12$ git pull origin master 
Password for 'https://[email protected]': 
From https://bitbucket.org/genadinik/marketing 
* branch   master  -> FETCH_HEAD 
error: The following untracked working tree files would be overwritten by merge: 
    .DS_Store 
Please move or remove them before you can merge. 
Aborting 

我能做些什麼來解決這個問題? 謝謝!

+0

更改了標籤,因爲這個問題與所有5個標籤沒有任何關係。 – borrrden

回答

30
rm .DS_Store 
git add -A 
git commit -m "Added .gitignore file" 

你還需要明確添加.DS_Store.gitignore這樣,當在未來不可避免地產生.DS_Store它不會妨礙你的提交。

+0

謝謝 - 你的意思是完全按照該命令做git commit -m「添加.gitignore文件」 – Genadinik

+0

引號中的部分只是一個提交消息;它可以是任何你想要的。 – warrenm

+0

你知道我的回購存在什麼問題嗎? :) – Genadinik

0

我想你需要先用add .添加的文件,然後pull然後commitpush

+0

pull命令給出此錯誤:錯誤:以下未跟蹤工作樹文件將被合併覆蓋: \t .DS_Store – Genadinik

+0

添加後。嘗試提交 –

1

你可能不關心.DS_Store。 因此,嘗試將其移動到.DS_Store.bak並再次拉動

+0

謝謝你,但給了這個錯誤:錯誤:您的本地更改以下文件將被合併覆蓋: \t .gitignore - 你會知道爲什麼會發生這種情況嗎? – Genadinik

+0

這是一般規則:origin/master包含未在本地回購庫中追蹤的文件。嘗試添加它(使用.gitignore進行提交) – xvorsx