Working with branches
Branches are symbolic names for lines of development. In Git, each branch is realized as a named pointer (reference) to some commit in the DAG of revisions, so it is called branch head.
Tip
The representation of branches in Git
Git uses currently two different on-disk representations of branches: the loose format and the packed format.
Take, for example, the master
branch (which is the default name of a branch in Git; you start on this branch in the newly-created repository). In loose format (which takes precedence), it is represented as the one-line file, .git/refs/heads/master
with textual hexadecimal representation of SHA-1 tip of the branch. In the packed format, it is represented as a line in the .git/packed-refs
file, connecting SHA-1 identifier of top commit with the fully qualified branch name.
The (named) line of development is the set of all revisions that are reachable from the branch head. It is not necessarily a straight line of revisions, it can fork and...