.gitkeep or .keep files in a git repo

A .gitkeep or .keep file is a dotfile that one creates when commiting an otherwise empty directory to a git repository. By convention empty directories are not committed to Git repositories.

So .gitkeep or .keep files should be excluded in your .gitignore to work:

For example you have got a log directory:

# ignore files in folder logs
log/*
# but please keep gitkeep in the folder
!log/.gitkeep