问题:
在使用git的过程中,会发现某些文件添加到忽略后仍然没有有效忽略
原因:
.gitignore文件只是ignore没有被staged(cached)的文件。对于已经被staged文件,加入ignore文件时一定要先从staged移除。
解决方法:
- 1 从staged状态移除
git rm --cached file/path/to/be/ignored。
- 2 提交, 执行
git rm --cached
后,需要进行一次提交
在使用git的过程中,会发现某些文件添加到忽略后仍然没有有效忽略
.gitignore文件只是ignore没有被staged(cached)的文件。对于已经被staged文件,加入ignore文件时一定要先从staged移除。
git rm --cached file/path/to/be/ignored。
git rm --cached
后,需要进行一次提交