Git · Junior · Question 12 of 75
Why doesn't Git track an empty directory?
- ✓Correct answer: Git tracks files, and a directory exists only through its files
- 2Empty directories are ignored by default in
.gitignore - 3Git removes empty directories to save disk space
Explanation
A tree object lists files and subtrees, so an empty folder has nothing to record. The usual workaround is a placeholder file such as .gitkeep.