2013-04-05 48 views
2

我不小心添加并提交了一个来自我本地回购的文件,我不想将其添加到我的GitHub项目的回购中。我可以用终端删除这个文件,或者我可以在线手动删除它吗?如何删除GitHub中的单个文件?

+2

的可能重复[我怎样才能删除提交GitHub上?(http://stackoverflow.com/questions/448919/how-can-i -remove-A-提交-ON-github上)。看看[这个答案](http://stackoverflow.com/a/449070/464744)。 – Blender 2013-04-05 20:25:43

+0

重复[如何从git repo删除文件?](http://stackoverflow.com/q/2047465/456814)。 – 2014-05-24 23:12:40

回答

5

从命令行,你可以做以下操作:

git rm <file> - remove file locally and marks it for deletion 
git commit -m"your message" - commit file to local repo 
git push origin master - push the change to github.