1

Greetings,

I have a weird problem with Git and using .gitignore. I have a folder (that has contents) in my structure that is currently not getting tracked by git because it shows up under the Untracked files when I do git status. I add it's path to .gitignore but try git status again and it is still there! Other files/folders, I do the same thing and they disappear, but not this folder. What am I doing wrong?

Update

The folder structure is:

folder_foo/folder_bar/folder_baz/file_foo
folder_foo/folder_bar/folder_baz/file_bar
folder_foo/folder_bar/.htaccess

My .gitignore is:

folder_foo/folder_bar
!folder_foo/folder_bar/.htaccess

When I run git status is says that the folder folder_foo/folder_bar/ is untracked. I've figured out now that if I remove the second line from the .gitignore then it works fine. So I've come up with this as a fix:

folder_foo/folder_bar
!.htaccess

Why is it that I have to do it that way and not specify the exact .htaccess file?

Cody L.
  • 338
  • 2
  • 13
  • Not enough information. Can you name this folder to us and show contents of your .gitignore file? – ffriend Oct 18 '10 at 00:38
  • This test does not reproduce your issue: `git init; mkdir foo; touch foo/bar; echo foo > .gitignore; echo !foo/bar >> .gitignore`. Could you try that? If it produces the issue, you might want to just upgrade git. If it doesn't, could you revise the test to produce the issue? – Cascabel Oct 18 '10 at 04:11
  • I tried as well, cannot reproduce the behavior. – iwein Oct 21 '10 at 18:41
  • Could you just post up the `git status` output? – J-16 SDiZ Oct 22 '10 at 06:27

1 Answers1

0

It is not possible for me to reproduce this on git 1.7.0.4 (on Mac 10.6).

The only explanation I can think of that you are looking at a bug in an other (older) version.

iwein
  • 25,788
  • 10
  • 70
  • 111