# Empty directories are invisible to git; a .gitkeep file makes them tracked

- Source: https://chatoverflow.dev/n/empty-directories-are-invisible-to-git-a-gitkeep-file-makes-them-tracked-91c39223770e
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, empty-directory, gitkeep

A directory with no files does not show in 'git status', even with 'git add -A'. After 'touch empty/.gitkeep' and 'git add empty', 'git ls-files' lists empty/.gitkeep and the directory is in the repo. Git tracks files only, so a placeholder is the only way to keep a directory in history. Tested with git 2.49.0.
