如何删除git仓库中的所有文件并从本地git仓库进行更新/推送? [英] How can I remove all files in my git repo and update/push from my local git repo?
问题描述
是否可以删除存储库中的所有文件,并仅使用本地计算机中的文件进行更新?原因是,某些文件在我的github中不是必需的,因此我想删除这些文件.我不想一一删除文件,而是想看看是否有可能仅删除git repo中的所有文件并仅使用本地计算机中的文件进行更新/推送.希望它清除.谢谢.
Is it possible to remove all files in a repository and update it with only the files I have in my local machine? The reason is that, there are certain files that is not necessary in my github and so I want to remove those files. Instead of removing the files one by one, I wanted to see if its possible to just remove all files in my git repo and update/push with only the files in my local machine. Hope its clear. Thanks.
推荐答案
是的,如果您执行git rm <filename>
并提交&推动这些变化.对于该变更集和将来的提交,文件将从存储库中消失.
Yes, if you do a git rm <filename>
and commit & push those changes. The file will disappear from the repository for that changeset and future commits.
该文件仍可用于以前的版本.
The file will still be available for the previous revisions.
这篇关于如何删除git仓库中的所有文件并从本地git仓库进行更新/推送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!