一、.gitignore文件不生效的情况
// 2、打开IDEA的Terminal窗口,进入到项目路径下
// 3、接着输入以下三条Git命令
// 3.1、清除当前的本地Git缓存
git rm -r --cached .
// 3.2、应用.gitignore等本地配置文件重新建立Git索引
git add .
// 3.3、(可选)提交当前Git版本并备注说明
git commit -m "update .gitignore"
原文链接:https://blog.csdn.net/weixin_42307507/article/details/118335145
二、忽略文件
*.exe 忽略exe文件
Debug/ 忽略Debug文件夹
#忽略 .a 文件
*.a
# 但否定忽略 lib.a, 尽管已经在前面忽略了 .a 文件
!lib.a
# 仅在当前目录下忽略 TODO 文件, 但不包括子目录下的 subdir/TODO
/TODO
# 忽略 build/ 文件夹下的所有文件
build/
# 忽略 doc/notes.txt, 不包括 doc/server/arch.txt
doc/*.txt
# 忽略所有的 .pdf 文件 在 doc/ directory 下的
doc/**/*.pdf
原文链接:https://blog.csdn.net/u014361280/article/details/106698832