当您习惯了将树呈现给用户的 Subversion 模型时,这有点奇怪,但是一旦您习惯了该模型,它就不会那么混乱了。
A git repository is just a tree of objects that explain how to transform a directory from one state to another. Those objects have a parent. Some objects have two (or more) parents; merges. Some objects have no parent; the initial commit.
As I understand it, internally, Subversion's model is similar minus the concept of where merges came from. Those are just new commits with a handy command (svn merge
) for getting a patch of the differences between two other commits.
I actually use this feature rather often to manage config files that started from the same directory on separate hosts, like /etc/apache2
. It's like saying, "this is the alternate start of this stuff, but it's been abandoned". It allows me to stash the state of some files before I overwrite them, but without having to worry about whether they merge right, or are even related to the master branch at all.
In Subversion I'd have to stow that backup in some un-related place (zip file somewhere) or in a subdirectory in the repository. Plus, in subversion, if I delete any reference to those files in the current view of the tree it becomes very hard to find them again.