push提交代码后.gitignore不生效

Outline

在 .gitignore 文件中新加了过滤规则,但push代码后发现规则并没生效;

解决

大概率是缓存问题,故执行下面操作:

git rm -r --cached .  # 删除缓存
git add .
git commit -m 'update .gitignore'
git push origin develop  # 提交到指定分支

操作后.gitignore生效

原文地址:https://www.cnblogs.com/bigtreei/p/14312453.html