How to Add Empty Directory in Git
One of the essential things about git is that it tracks the changes in files only and not the folder itself, which can be found here . The directories are added automatically when adding files inside them. Also, when you run git add <directory_name>
, the files inside that directory are added instead of the directory itself.
Some might question why add an empty directory? But to maintain the folder structure of the project, it comes in handy to add an empty directory to the project since it helps understand the coding convention and the overall structure of the project.
There are simplest workarounds like adding empty files like touch .placeholder
or .gitkeep
, creating README
or ABOUT
file inside that directory to tell git to track that particular folder too.