I have data directory in project’s root. It has images directory and some files. Here is example:
data
├── images
│ ├── image1.jpg
│ ├── image2.jpg
│ └── image3.jpg
├── results.csv
└── r.txt
What to write in gitignore, to ignore files from data/ directory (that is results.csv and r.txt) and files from images/ directory (image.jpg, image2.jpg, image3.jpg)?
When I commit it, folder structure in repository should be:
data/
└── images/
So, I just want empty folder structure to be commited.
In Git, you cannot commit empty folders, because Git does not actually save folders, only files. You’ll have to create some placeholder file inside those directories if you actually want them to be “empty” (i.e. you have no committable content).