Adding an empty directory to a Git repository

Unlike with Subversion, one cannot add an empty directory to a Git repository.

Naturally, there’s a way around this.

Create a .gitignore file within the subdirectory and add these lines:

# Ignore everything inside this subdirectory...
*
# ...except for this file
!.gitignore

As the comments detail, the first line tells Git to ignore everything inside the directory except for the .gitignore file itself.