Use exclamation in .gitignore to track something specially?

Viewed 3750

Here is my project folder:

aaa
  ├─ bbb.txt
  ├─ ccc.txt
  └─ ddd.txt
.gitignore

For my own, I wanna ignore all the files or folders in aaa except bbb.txt

So, I write the .gitignore like this:

aaa/
!aaa/bbb.txt

But bbb.txt is also tracked.

So, could you tell me how to solve this?

Update:

After I read the comment and the answer, I begin to understand how to fix this question.

But I come to a new question:

What's the difference between a/ and a/* and a/**?

1 Answers
Related