前言
当我们提交了一些文件远程,但是又想加到忽略文件禁止下次提交
可以用git命令的如下的姿势来实现。
姿势
主要是用到了 git rm
来实现
- 带上
--cached
该命令并不会删除实际的代码文件。
- 没有
--cached
会删除实际的代码和索引,慎用!
先在.gitignore 里面增加新的忽略范围,然后再删除对应的缓存索引提交即可生效!
AME
git-rm - Remove files from the working tree and from the index
SYNOPSIS
git rm [-f | --force] [-n] [-r] [--cached]