Reputation: 125
Is it possible to have
foo/
in .gitignore but then not to ignore
bar/foo
without adding
!bar/foo
to .gitignore
Upvotes: 3
Views: 64
Reputation: 61437
Use /foo/ instead, / matches the beginning of the path. From the gitignore manpages:
/foo/
/
A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
Upvotes: 9