# How to unignore files in certain directories?

2 messages from 2012-07-25 to 2012-07-25. Participants: Peng Yu, Junio C Hamano.
Thread: https://gitlist.dev/t/31098

## Peng Yu, 2012-07-25 15:48

Subject: How to unignore files in certain directories?
Message-ID: <CABrM6wk+acut6EaoK=_GuQw3w9vhn_4ONoF21cj1GtEtHFWBKQ@mail.gmail.com>
URL: https://gitlist.dev/e/CABrM6wk%2Bacut6EaoK%3D_GuQw3w9vhn_4ONoF21cj1GtEtHFWBKQ%40mail.gmail.com

```
Hi,

I have the following in .gitignore to ignore *.txt files.

*.txt

But I want to keep the *.txt files in, for example, data/ and all its
subdirectories. I don't know should the the correct way to unignore
these *.txt files. Could anybody show me the command that I should add
to .gitignore? Thanks!

-- 
Regards,
Peng

```

## Junio C Hamano, 2012-07-25 18:05

Subject: Re: How to unignore files in certain directories?
Message-ID: <7vmx2nbtt5.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmx2nbtt5.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CABrM6wk+acut6EaoK=_GuQw3w9vhn_4ONoF21cj1GtEtHFWBKQ@mail.gmail.com>

```
Peng Yu <pengyu.ut@gmail.com> writes:

> Hi,
>
> I have the following in .gitignore to ignore *.txt files.
>
> *.txt
>
> But I want to keep the *.txt files in, for example, data/ and all its
> subdirectories. I don't know should the the correct way to unignore
> these *.txt files. Could anybody show me the command that I should add
> to .gitignore? Thanks!

Have you checked "git help gitignore" and looked at its example
section?  I think the second example is exactly the same as what you
described above.

```
