I just did a git init on the root of my new project.
Then I created a .gitignore file.
Now, when I type git status, .gitignore file appears in the list of untracked files. Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
.gitignorefile should be in your repository, so it should indeed be added and committed in, asgit statussuggests. It has to be a part of the repository tree, so that changes to it can be merged and so on.So, add it to your repository, it should not be gitignored.
If you really want you can add
.gitignoreto the.gitignorefile if you don’t want it to be committed. However, in that case it’s probably better to add the ignores to.git/info/exclude, a special checkout-local file that works just like .gitignore but does not show up in “git status” since it’s in the.gitfolder.See also https://help.github.com/articles/ignoring-files