如何让.gitignore文件生效

改动过.gitignore文件之后,在repo的根目录下运行

# 先将当前仓库的文件的暂存区中剔除
git rm -r --cached .

# 再添加所有的文件到暂存区,这时.gitignore文件就会生效了
git add .

# 提交
git commit -m "fixed untracked files"

原文地址:https://www.cnblogs.com/ZhangRuoXu/p/6706515.html