thisissami
thisissami

Reputation: 16373

How do I ignore a directory (/dir/) with .gitignore but keep an identically named subdirectory (/other/dir/)?

I have a directory entitled dir in the top directory of an app i'm working on that I'd like to ignore. As such, I have included dir/ in my .gitignore file. However, in another folder, I have a different directory called dir (specifically, other/dir/). How can I go about ignoring the top level dir without ignoring the subdirectory?

Would a !other/dir/ do the trick?

Upvotes: 0

Views: 72

Answers (1)

Sylvain Guillopé
Sylvain Guillopé

Reputation: 1367

You could try something like that?

/dir/

It should then only ignore the dir folder that is at the root.

Upvotes: 2

Related Questions