使用Git的时候,有时候不小心使用git add,添加了不想追踪的文件。也就是track了一些不想track的文件,这个时候需要撤销操作,怎么处理呢?

Git 文件状态的生命周期
演示

还原操作
-
使用git reset命令
git set命令效果 -
使用git rm --cached [filename]命令
git rm命令效果
git rm
--cached
Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone.
额外
在文件未被git track的时候,可以添加.gitignore文件,来指定不想追踪那些文件。

gitignore的效果
最后
简单的介绍了git的一些基本功能