My .gitignore looks more less like this:
# Ignore everything
*
# But not these files...
!.gitignore
!ImportantDirectory/
!AnotherImportantDirectory
# Actually, ignore these...
ImportantDirectory/NotImportantFile
The problem is that ImportantDirectory/NotImportantFile is still being tracked. Any idea how to solve this?
If you had previously included that file, it will continue to be tracked until you remove it from your repository, even if you list it in a .gitignore. Sounds like that is what is happening here. You can do that with:
git rm --cached ImportantDirectory/NotImportantFile
Note this will remove the file from the .git repository, but will not delete the local file on disk. Note however this will delete ImportantDirectory/NotImportantFile for anyone who pulls your git repository, so if this is a file they also need to maintain, but not have included, you may need to take a different approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With