[英]put files under version control - how to untrack them and ignore
I've added files under version control. 我已经在版本控制下添加了文件。 Now I need to remove them from version control and ignore in my project. 现在,我需要从版本控制中将其删除,并在我的项目中将其忽略。 Is it enough to just put those files inside .gitignore
or I have to delete them first? 仅将这些文件放在.gitignore
就足够了,还是我必须先删除它们? What's the correct procedure? 正确的程序是什么?
If you want to remove the file from git while leaving it in your working directory, you need to git rm --cached
the file, then commit. 如果要从git中删除文件,同时将其保留在工作目录中,则需要git rm --cached
该文件,然后提交。 If you just add the file to .gitignore
, the current version of the file will remain in git. 如果仅将文件添加到.gitignore
,则文件的当前版本将保留在git中。
Yes, .gitignore
is it enough (if you just want do not track this files) But if you want delete it from your project and from git - delete files 是的, .gitignore
就足够了(如果您只想不跟踪此文件),但是如果要从项目和git中删除它-删除文件
Thats all ;) 就这样 ;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.