Does Git delete empty folders?

I completed and migrated the project to my GitHub account.

This project contains the following partial file structure:

server | --- conf | ----- some files | --- java | --- lib 

The java and lib folders are empty.
When loading my project from GitHub, the resulting zip did not contain java and lib folders.

Does Git delete empty folders?
I am using Atlassian SourceTree as my Git client.

+7
git github atlassian-sourcetree
source share
1 answer

Git does not delete empty folders; Git cannot track empty folders (or any folder) in the first place. Git only tracks files; folders are random. Git creates folders on disk to host files; A folder without files in it does not exist in the Git world.

If you want to keep the "empty" folder in the Git repository, the convention is to add a hidden empty file to this directory, for example /java/.gitkeep

+16
source share

All Articles