忽略特殊文件 忽略文件的原则是: 忽略操作系统自动生成的文件,比如缩略图等; 忽略编译生成的中间文件、可执行文件等,也就是如果一个文件是通过另一个文件自动生成的,那自动生成的文件就没必要放进版本库,比如Java编译产生的.class文件; 忽略你自己的带有敏感信息的配置文件,比如存放口令的配置文件。 强制添加 可以用-f强制添加到Git git add -f App.class 自定义忽略某些文件时,需要编写.gitignore; .gitignore文件本身要放到版本库里,并且可以对.gitignore做版本管理!