Laurie Young Laurie Young - 3 months ago 14
Git Question

How can I add an empty directory to a Git repository?

How can I add an empty directory (that contains no files) to a Git repository?

Answer

Another way to make a directory stay empty (in the repository) is to create a .gitignore file inside that directory that contains four lines:

# Ignore everything in this directory
*
# Except this file
!.gitignore

Then you don't have to get the order right the way that you have to do in m104's solution.