您的位置:首页 > 其它

解决.gitignore无法忽略部分文件

2016-01-20 20:11 316 查看

解决.gitignore无法忽略部分文件

在使用
git
时,有时忘了写
.gitignore
文件。即先执行了诸多
git add
,
git commit
,
git push
等,然后加上了
.gitignore
文件。此时会发现
.gitignore
没用了,往往反复改正
.gitignore
,结果都没用。

其实,
git
已经tracking了某些想忽略的文件。所以只需执行
git rm -r --cached ignoreFile
ignoreFile就是你想忽略的文件
),让
git
不再
tracking
这些文件。然后

git add -A


git commit -m "msg"


git push origin master


这样就完美解决了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: