10

I've committed and pushed a project to my GitHub account.

This project contained the following partial file structure:

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

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

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

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • @Idan Adar -- just an FYI, regarding the http://stackoverflow.com/questions/tagged/worklight-adapters tag, I've had to go through a number of your previous tag wiki suggestions and add sources for heavily plagiarized text. Per http://meta.stackoverflow.com/questions/256436/how-to-deal-with-plagiarized-content-in-tag-wikis?lq=1 and numerous other Meta links, tag wikis need to have a source attribution if heavily copy-and-pasted. See http://stackoverflow.com/review/suggested-edits/6357996 for a good example. – LittleBobbyTables - Au Revoir Dec 11 '14 at 18:00
  • 1
    @LittleBobbyTables No problem. I'll add a link to our website... It's hardly plagiarized. :) – Idan Adar Dec 11 '14 at 18:10
  • 1
    @LittleBobbyTables, source added. – Idan Adar Dec 11 '14 at 18:13
  • Great Idan... good luck. – Idan Gozlan Apr 14 '15 at 11:20

1 Answers1

20

Git doesn't delete empty folders; Git cannot track empty folders (or any kind of folder) in the first place. Git only tracks files, the folders are incidental. Git only creates folders on disk in order to house files; a folder with no files in it does not exist in Git's world-view.

If you want to keep an "empty" folder in your Git repository, the convention is to add a hidden empty file to that directory, such as /java/.gitkeep

user229044
  • 232,980
  • 40
  • 330
  • 338