What about the git storage system
Maybe this is stupid question, but I'd like to raise here since it's not clear for me: git commit file cont开发者_C百科ent as snapshot relative to svn commit as delta storage systems, does it mean git needs more disk space than svn ? personally thinks it shall be delta in reasonable.
Actually, given the fact that git uses zlib conversion for every object, it turns out that git is more efficient than svn: for example, the Ruby on Rails Git repository download, which includes the full history of the project, is currently about 13M, which is much less than the size of a single checkout of the project, about 9M. The svn server repository (i.e. whole history) for Ruby on Rails is about 115M.
Logically, git stores every file (actually, every object) in the repository by itself and identifies them by their SHA1. You can look at this yourself, the objects are in directories in .git/objects
that are identified by the first two characters of the SHA1.
But git also supports storing (and transferring) the objects in so called packfile. This file contains objects that are compressed using zlib. But it can also contain delta-compressed objects that reference another object in the same packfile (it doesn't have to be the previous version of the same file).
Objects saved as normal files are compressed into a packfile when you call git gc
. This also happens automatically during some of the git operations that are likely to produce those “loose objects”.
Because of all this, git working directory is often smaller than SVN working directory. Which is great, considering that git working dir contains all the history of the repo. (SVN working dir is usually about twice the size of the files in it. That's because it contains another copy of every file for diffing and commiting.)
精彩评论