Commit empty folder structure (with git)

Иван Бишевац picture Иван Бишевац · Jan 26, 2013 · Viewed 119.8k times · Source

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.

Answer

Joost van der Laan picture Joost van der Laan · Nov 11, 2013

Just add a file .gitkeep in every folder you want committed.

On windows do so by right clicking when in the folder and select: Git bash from here. Then type: touch .gitkeep