Sourabh Dev
Sourabh Dev

Reputation: 743

Avoid ignoring a folder in git

I have a two directories named "static" in my project. One with the path "static/" and the other with a path "core/static/". I want to gitignore the first static directory, but I want the "core/static" directory to be tracked.

My current .gitignore file contains:

static
!core/static

Upvotes: 2

Views: 34

Answers (1)

DJanssens
DJanssens

Reputation: 20809

change static to /static.

The leading / makes git use an absolute path, this will only ignore the directory specified at that specific absolute location.

Upvotes: 3

Related Questions