Within a few months we migrated from SVN to Git in our company. During the migration, we recognized empty folders for Caching or meant to be for generated PDFs, were not added to the Repository. Git saves itselfs adding empty folders in the version control and does not persuade itself with commands like “git add foldername” or “git add *”.
Use .keep Files
For the reason Git needs to have a file in a folder to add it to the repository, it has been adopted to developers to accomplish Git this desire. Just create an empty .gitkeep, .keep or .whatever file in the usually empty folder.
With a commit and push it’s done. Easy, isn’t it?
$ touch pdfs/.keep
If there are Log – or like in our case generated PDF files – which shouldn’t be added in the git repo, it is recommended to add a few entries to the .gitignore file.
# don’t ignore keep files
This post is also available in: Deutsch (German)