References
In addition to the Git objects, which are immutable – that is, they cannot ever be changed, there are references also stored in Git. Unlike the objects, references can constantly change. They are simple pointers to a particular commit, something like a tag, but easily moveable.
Examples of references are branches and remotes. A branch in Git is nothing more than a file in the .git/refs/heads/ directory that contains the sha-1 of the most recent commit of that branch. To branch that line of development, all Git does is create a new file in that directory that points to the same sha-1. As you continue to commit, one of the branches will keep changing to point to the new commit sha1s, while the other one can stay where it was.
No comments:
Post a Comment