Search code examples
gitgitignore

.gitignore file itself is not being ignored after an edit


Prior to editing the .gitignore file in a project the following files were displayed when the status was queried:
enter image description here

Wanting to ignore the multiple versions of sandbox Vue files, this was added to the project's .gitignore file at the bottom:

# app files
/src/modules/admin/views/sandbox*.vue

Now when the status is queried the following is displayed:
enter image description here

Why is ../.gitignore being displayed now? What should be changed so that file is not displayed?


Solution

  • This means that .gitignore is a tracked file.... so you changed it, so it shows up as changed. This would be the expected result... and it makes sense. Do you want to ignore .gitignore? This is not quite a good idea because by tracking it, everyone gets to ignore the same things in the project. Now, if you would like to be the only person in the project to be ignoring the files that you started the question from, you might have to consider adding that to .git/info/exclude so that it's only on you and no one else.