Including an empty directory in a Git repo can be useful for binary or object directories, so you don’t have to bother with
mkdir commands in the build system.
Include an empty directory in a Git repo by creating an empty file, even if the directory itself is in
.gitignore as follows.
This example assumes
build/ contents should be ignored by Git, but the empty directory should exist in the Git repo.
make an empty file in
build/and add it to Git:
touch build/.ignore git add -f build/.ignore
git commitas usual.