不慎在建立.gitignore 文件以前的时候将文件push到了 git仓库,即便以后在.gitignore文件中写入新的过滤规则,这些规则也不会起做用的,git依然会对全部git仓库中的文件进行管理,html
首先我是用 git
git rm -r
此命令去删除而后提交到git仓库,后面发现这样会将本地文件删除,并非我想要的效果,缓存
最终找到命令 bash
git rm -r --cached
成功将git仓库中的 文件删除 并保留文件在本地ide
1.删除本地仓库文件ui
git rm 文件名称
2.删除本地仓库中文件夹,这里r 表明递归全部文件和文件夹htm
git rm -r 文件夹名称
3.将删除文件缓存递归
git add -u
4. 提交变动,这里 -m 是写入注释rem
git commit -m '个人变动内容'
5.推送到git远程仓库,xxx表明远程地址文档
git push origin xxx
$ git rm -h usage: git rm [<options>] [--] <file>... -n, --dry-run dry run -q, --quiet do not list removed files --cached only remove from the index -f, --force override the up-to-date check -r allow recursive removal --ignore-unmatch exit with a zero status even if nothing matched
本文永久更新地址:http://siyouku.cn/article/6855.html