I created an Android project, added it to my git repo, comitted and pushed my clone to the master. Later I tried checking out the project and Eclipse complained about missing src folders. I checked my repo and the master repo and the src folders are missing (Im sure they were there when I created the project). So can someone explain what happened here? Im new to git so maybe I missed something?
+5
A:
Yes, git ignores empty folders.
You can add an empty .gitignore file to any folders you want included.
Michael Forrest
2010-06-12 22:00:12
+1
A:
git ignores all directories whether they're empty or not.
git will recreate directories when building out a tree on disk when a file needs to exist in a directory that does not. Otherwise, no attention is paid to directories.
Dustin
2010-06-12 22:28:48
A:
Yes, git will not track empty folders. Find a full discussion here on StackOverflow
labratmatt
2010-06-12 22:33:03
+2
A:
Git doesn't ignore empty directories. It ignores all directories. In Git, directories exist only implicitly, through their contents. Emtpy directories have no contents, therefore they don't exist.
Or to put it another way: Git is a content tracker. Empty directories are not content.
Jörg W Mittag
2010-06-12 23:08:15
Not exactly. git has a concept of "tree" (which corresponds to a directory), and the tree actually has a sha1 hash, and thus has content: the list of blobs (files) and trees (sub-directories). So `git` actually can (in theory) record empty directories. The problem lies in the index file (the staging area): it only lists files; and commits are built from the index file.
hasen j
2010-06-13 08:05:29