Does Git store history when an empty directory was created?
I am converting Subversion to Git recently using git-svn.
I know that I have to add .gitkeep to add an empty directory in Git.
Does it mean that Git does not store history when a directory was created?
My Subversion repository has many empty directories and if I added .gitkeep to all empty directories for Git, it means that the directories’ history wwas seen as if they were created now, not the exact days when the empty directories were created.
- Grab the svn HEAD git commit number?
- Clone multiple SVN projects with git-svn
- How to make git-svn use specific version of SVN?
- How to make git-svn act like the keyword expansion of SVN?
- git svn fetch retrieves the same Subversion revision multiple times for branches
- git svn dcommit fails because of assertion error “svn_fspath__is_canonical(child_fspath)” (cygwin)
2 Solutions collect form web for “Does Git store history when an empty directory was created?”
No, Git does not store information about directories.
git-svn has facilities to take care of this for you.
git svn clone --preserve-empty-dirs will take care of empty directories for you while cloning. It will create a placeholder file to track empty directories (by default
.gitignore) and remove them as appropriate.
git-svn also stores untracked empty directories.
git svn mkdirs can be used after a checkout or reset to recreate empty directories.
Finally there is the
svn-remote.<name>.automkdirs config value to control whether
git svn clone and
git svn rebase will run
git svn mkdirs for you.
You can’t add directories to Git, only files. So yes, Git doesn’t know when empty directories were added–because empty directories can never be added.