The .gitignore
file's purpose is to prevent everyone who collaborates on a project from accidentally commiting some common files in a project, such as generated cache files. Therefore you should not ignore .gitignore
, since it's supposed to be included in the repository.
If you want to ignore files in just one repository but want to avoid committing the ignore list (for example for personal files) you can add them to .git/info/exclude
in that repository.
If you want to ignore certain files on every repository on your machine you can create the file ~/.gitignore_global
and then run
git config --global core.excludesfile ~/.gitignore_global
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…