2012-06-20 103 views
14

我從我的本地倉庫中刪除了python .pyc文件,我認爲我做的是從遠程github上刪除。如何從GitHub存儲庫中刪除文件?

我推送了所有更改。這些文件仍在回購站上,但不在我的本地計算機上。我如何從github倉庫中刪除文件?

我試過如下:

git rm classes/file.pyc 
git add . 
git 

,甚至:

git rm --cached classes/file.pyc 

然後當我嘗試檢出文件,我得到這個錯誤。

enter code here`error: pathspec 'classes/redis_ha.pyc' did not match any file(s) known to git. 

我現在不知道還能做些什麼。截至目前,我有一個完全損壞的git回購。

+3

你有沒有'混帳commit'和'混帳rm'後'混帳push'? – geoffspear

+0

重複[如何從git repo刪除文件?](http://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-git-repo) – 2014-05-24 23:13:03

回答

29

你不應該做git add。這是所有

git rm classes/file.pyc 
git commit -m"bla bla bla" 
git push 
-1
git commit -am "A file was deleted" 
git push 
+0

這也將對索引中已存在的文件進行任何其他更改,因此許多團隊被認爲是不安全的。總是檢查要提交什麼更好 – Vasfed

相關問題