Search code examples
gitgithubgitignore

How to exclude file from ignore list of gitignore


I have two files .cat and .inf which are not mentioned in the .gitignore file. But still, they are greyed out in VS code which shows that they are not getting committed/uploaded to the git repo.

my-file.cat my-file.inf

I am using the visual studio default .gitignore file.

ref: https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

how to explicitly mention to include some files. or are there any global ignore settings in which these files are mentioned to be ignored by default?


Solution

  • You can explicitly tell .gitignore file to include some files by prefixing a bang like

    !my-file.cat
    !my-file.inf
    

    You should prefer to actually figure out what's making them be ignored though. (Maybe they're in an ignored folder?)