Standardize & acceptable ways to commit a temporary empty directory in git?

Viewed 338

I find out there are many ways that people have been trying to commit a temporary directory. Should there be a standardized one? If yes, which one would it be? (it would be better to hear your justification too)

Here are a list of possible solution to track your directory in git:

  • commit .gitdirectory file. IMHO, it is more intuitive to use the word directory which refers to committed directory.
  • commit .gitkeep file. Unfortunately this is not documented as mentioned in the answer. But people have seems to agreed upon this to be the standard. I couldn't find any particular reason why this is more acceptable compared to .gitdirectory intuitively. (perhaps for some historical reason from other SVC tools to enforce .keepme file.
  • commit .gitignore file. This is by far official documented solution of committing an empty directory. Unfortunately there's a discussion going on .gitignore vs .gitkeep.

    some people see this as confusing since the goal is to keep the empty directories, not ignore them;

  • commit README file. Anyway you have to write what this directory is for, and what files will be put there in the future. (It also solve the documentation problem too)

My philosophy is to keep things clean with what the majority of the community accept as the best practices or conventions of doing certain things.
How you would add an empty folder with Git?

2 Answers
Related