使用.gitignore文件删除掉已经提交的文件
顺序依次执行如下命令:
First commit any outstanding code changes, and then, run this command:
git rm -r --cached .
This removes any changed files from the index(staging area), then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"
最后提交到远程仓库,会发现.gitignore文件起作用了。
本文介绍如何通过.gitignore文件排除已提交的文件。首先提交所有更改,然后使用git命令从索引中移除更改的文件,接着重新添加所有文件并提交,最后推送到远程仓库,验证.gitignore文件是否生效。
929

被折叠的 条评论
为什么被折叠?



