在使用git的时候我们有时候需要忽略一些文件或者文件夹。我们一般在仓库的根目录创建.gitignore文件
在提交之前,修改.gitignore文件,添加需要忽略的文件。然后再做add  commit push 等
但是有时在使用过称中,需要对.gitignore文件进行再次的修改。这次我们需要清除一下缓存cache,才能是.gitignore 生效。
具体做法:
git rm -r --cached . #清除缓存git add . #重新trace filegit commit -m "update .gitignore" #提交和注释git push origin master #可选,如果需要同步到remote上的话
这样就能够使修改后的.gitignore生效。
git rm -r --cached . #清除缓存

git add . #重新trace file

git commit -m "update .gitignore" #提交和注释

git push origin master #可选,如果需要同步到remote上的话
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。