Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is it possible to add the .gitignore file to .gitignore itself?

.gitignore

Doesn't work though

I don't want to see it in edited files

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
646 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...