解决 .gitignore 无效的问题

git

首先确定好需要忽略的文件或文件夹,并加入到 .gitignore 中,然后执行:

1
2
3
4
git rm -r --cached .
git add .
git commit -m "update .gitignore"
git push -u origin master

若你的另一台机子也需要更新代码,那么他在 git pull 的时候,.gitignore 中你刚才添加的文件和文件夹都会删除,记得重新生成或新建上。