How can I add an empty directory (that contains no files) to a Git repository?
Here is a hack, but it's funny that it works (Git 2.2.1). Similar to what @Teka suggested, but easier to remember:
git submodule add path_to_repo
).submodules
. Commit a change..submodules
file and commit the change.Now, you have a directory that gets created when commit is checked out. An interesting thing though is that if you look at the content of tree object of this file you'll get:
fatal: Not a valid object name b64338b90b4209263b50244d18278c0999867193
I wouldn't encourage to use it though since it may stop working in the future versions of Git. Which may leave your repository corrupted.