3

I have a project directory that includes the following:

log/
src/log/
tests/log/
.gitignore

In my .gitignore file, I added the following line, thinking it would just ignore the top-level log/:

log/

However, it also seems to ignore src/log and tests/log. How can I prevent it from doing that?

Evan
  • 151
  • 1
  • 7
  • @MattMcNabb The first code block is my directory structure. The second code block is what's actually in my .gitignore file. – Evan Jul 19 '15 at 01:53
  • @Evan yeah, I realized that just after commenting. I guess the other answerer also made the same error! – M.M Jul 19 '15 at 01:54
  • 1
    @closers this is asking about ensuring that a .gitignore line matches only the top-level directory and leaves subdirectories alone. It's not about ignoring everything, then whitelisting subdirectories. – Evan Jul 19 '15 at 01:55

1 Answers1

3

Use /log/ instead; this means it will only ignore directory log which occurs at the top level of your project.

M.M
  • 138,810
  • 21
  • 208
  • 365
  • Blah, I knew it was something stupid I was blanking on. Thanks! (Will accept when it lets me) – Evan Jul 19 '15 at 01:51