问题描述
我初始化了一个git仓库,并且因为某些原因我已经做了一些提交,我不想跟踪它中的任何文件,并希望git离开它。
有没有什么办法可以取消初始化它?
I have Initialized a git repository and have made some commit in that now for some reason I do not want to track any files in it and want git going out of it.Is there some way I can Uninitialize it?
推荐答案
git将所有资源库相关数据存储在名为 .git放入你的存储库文件夹中。所以你只想保留你的文件,但把它改成一个not-git-repository。警告:这是不可逆转的!
git stores all the repository related data in a folder named ".git" inside your repository folder. So you just want to keep your files but change it into a "not-git-repository". Warning: this is irreversible!
cd path/to/repo
rm -rf .git
可能会保留的唯一文件是隐藏的.gitignore文件(但仅当您自己添加它们或使用某种工具蚀)。删除它们:
The only files that might remain are hidden ".gitignore" files (but only if you added them yourself or using some tool like eclipse). To remove them:
find . -name ".gitignore" | xargs rm
这篇关于取消初始化git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!