I have a .gitignore file in a few directories (ex. log/) with the following contents:
* " Ignore everything in this directory
!.gitignore " Except this file
Nonetheless, if there is a file in that directory, git status shows it to me saying it’s new but untracked.
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# log/blah.log
nothing added to commit but untracked files present (use "git add" to track)
I have found other posts on stackoverflow suggesting putting a comment on the first line and various other forms or random voodoo, but nothing has worked.
Simply, I want a tmp/ and log/ directory to exist in my repo, but empty. I don’t want anyone to be harassed to add their log and tmp files to these directories.
Are you expecting the double-quote to act like a comment in your
.gitignorefile? You’ve got this……but that’s doing what you want. If you replace it with simply:
It will work just fine. Watch: