How can I add an empty directory (that contains no files) to a Git repository?
The solution of Jamie Flournoy works great. Here is a bit enhanced version to keep the .htaccess
:
# Ignore everything in this directory
*
# Except this file
!.gitignore
!.htaccess
With this solution you are able to commit a empty folder, for example /log
, /tmp
or /cache
and the folder will stay empty.