如何让.gitignore文件生效

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

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

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

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

posted @ 2017-04-13 22:23  ZhangRuoxu  阅读(1894)  评论(0编辑  收藏  举报