2013-06-26 26 views
1

這是我第一次使用git(在bitbucket.org上 - 如果這有什麼區別),我提交了一些音頻文件到我顯然不想在那裏的回購。我添加然後添加路徑到.gitignore發現這隻會忽略進一步的變化。 所以我偶然發現了this SO question並試圖使用那裏提到的David Underhill's script試圖從git中刪除文件,現在分支機構發生分歧,我無法推送更改

不過,現在我得到以下消息git commit

# On branch master 
# Your branch and 'origin/master' have diverged, 
# and have 10 and 10 different commits each, respectively. 
# 
nothing to commit (working directory clean) 

git push

! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to 'https://bitbucket.org/abc/def' 
To prevent you from losing history, non-fast-forward updates were rejected 
Merge the remote changes (e.g. 'git pull') before pushing again. See the 
'Note about fast-forwards' section of 'git push --help' for details. 

所以我嘗試了git push --force其成功,但實際上並沒有改變任何東西的回購,甚至沒有出現在那裏。

你知道我該如何解決這個問題嗎?

+0

這很奇怪。請git推-f和git狀態併發布所有輸出 –

回答

1

A git filter-branch將重寫提交的SHA1的歷史記錄,所以錯誤消息是有意義的。

如果你的本地回購是在分支主,並有這些文件中移除了,然後git push -f將反映的是你的到位桶回購。

如果不是這樣,它可能是因爲你沒有在第一時間推本地主(嘗試git push -f origin master可以肯定的)。
因爲你是(本地)在detached head mode

相關問題