.gitignore无效
2021-09-23 本文已影响0人
李晓通
在根目录中新建.gitignore文件,设置如下:
.idea
log/
target/
*.iml
若没有生效,是因为gitignore只能忽略那些原来没有被 track 的文件,如果某些文件已经被纳入了版本管理中,则修改 .gitignore 是无效的。
解决方法是先把本地缓存删除,然后再提交。
git rm -r --cached .
git add .
git commit -m "update .gitignore"
git push -u origin master