collimarco
collimarco

Reputation: 35400

Git Glob syntax: ignoring files everywhere or in a specific folder

I would like to exclude .DS_Store tracking from myfolder and all subfolders. I also want to exclude a .project file from myfolder (but not from its subfolders).

What should I write in .gitignore (situated in myfolder)?

.DS_Store # or *.DS_Store ? I mean, is the asterisk necessary?
./.project # is this syntax correct?

Upvotes: 3

Views: 2091

Answers (1)

Abe Voelker
Abe Voelker

Reputation: 31574

This should do the trick:

.DS_Store
/.project

When you a provide a path to .gitignore, it applies it based on where the .gitignore file is (a chroot, if you will). So the / on the second line means only ignore the myfolder/.project file.

Upvotes: 5

Related Questions