all that is technology

Adding empty directory within GIT


While maintaining GIT repositories, in some cases, we might be required to add an empty directory as a placeholder to mean something or we wanted all the files in a directory to stay local. However in GIT we can add only files to the repository and not the directory.

I came across the following stackoverflow post, which suggest a workaround.

It basically suggest to add a .gitignore file in the directory with the following line.

# Ignore everything in this directory
# Except this file

Hope this helps.