Git & GitHub · Lesson 116 of 144
Empty Folders
Why Git ignores them.
Try this. Make an empty folder, and run git status. Git says nothing. Git tracks files, not folders. A folder only exists in Git because files are inside it.

- An empty folder
- git status says nothing
- Git tracks files, not folders
The empty folder trick
We make an empty folder called images. Status shows nothing. The common trick is to put an empty placeholder file inside, called dot git keep. Now status shows the folder, and we can commit it.
git
mkdir images git status --short touch images/.gitkeep git status --short ?? images/ git add images git commit -m "Add images folder" [main 50315ec] Add images folder 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 images/.gitkeep
About .gitkeep
.gitkeep isn't special to Git. It's just an empty file, with a name everyone recognises. Some people use a readme file instead, explaining what the folder is for. Either way, the folder now has a file, so Git tracks it.
.gitkeepjust a convention
Empty fileany name works
Or a READMEexplain the folder
Resultthe folder is tracked
Summary
Git tracks files, not folders. Put a dot git keep file in a folder to keep it. Next, renaming a file when only the capital letters change.
Key takeaways- Git ignores empty folders
- touch folder/.gitkeep
- Commit it
Next up: Changing Capital Letters — case-only renames