Reputation: 2550
I've been looking around and just could not find the same scenario that I have. I have:
--public
|--img
|--logo (folder)
|--post_image (folder)
|--banner.jpg
|--icon.ico
|--image1.jpg
|-........etc
I need to ignore the logo
and post_image
folders, but I want to keep every file that is inside img
folder. How would I go about it?
Right now I have **/public/img
but I feel is not the right approach!
Upvotes: 37
Views: 15402
Reputation: 157
Please try below options .
public/img/*
!public/img/logo/
!public/img/post_image/
Upvotes: 4
Reputation: 19895
I found this to be simpler (at least in the case there are many subfolders):
public/img/*/
This will exclude all subfolders in public/img/
, but will not exclude the files in this folder.
Upvotes: 52
Reputation: 10453
You can put a .gitignore
file into any child directory, it doesn't have to be at the root. In your case, a .gitignore
file in the public/img
directory with the content:
logo
post_image
would do the job.
For another approaches, you might want to look at:
Upvotes: 8