Information Technology Reference
In-Depth Information
The above symbolic form of the reference says that your current revision is the one
pointed to by the branch named master .
Branches are stored in the .git directory in one of two different formats:
• Loose format
• Packed format
Loose format branches are stored within the .git/refs/heads directory. Every
branch is stored in a separate file. In the symbolic reference ref: refs/heads/
xyz the part refs/heads/xyz is a path to the file .git/refs/heads/xyz .
This file contains the SHA-1 name of the latest revision in branch xyz .
In the packed format many references, such as ref: refs/heads/xyz , ref:
refs/heads/foo , and ref: refs/heads/bar , are stored in a single
file— .git/packed-refs . In a newly initialized repository the file .git/
packed-refs doesn't exist. This means that by default the references are initially
stored in a loose format.
When you initialize a new repository it doesn't contain any revisions—its database
is empty. The file .git/HEAD contains the entry ref: refs/heads/master
and the folder .git/refs/heads is empty—the file refs/heads/master
doesn't exist. The new repository contains a single branch named master , which
doesn't contain any revisions.
Once you create the first revision with:
$ echo m1 > m1.txt
$ git snapshot m1
then your repository is not empty any more. The file .git/HEAD does not change—it
still contains the same entry pointing to .git/refs/heads/master . But now the
directory .git/refs/heads contains a single file named master . This file stores
the SHA-1 of the revision labeled m1 . You can check it with following two commands:
$ git log --pretty=oneline
$ cat .git/refs/heads/master
Comparing the output of the above commands you will notice that the SHA-1 stored
in .git/refs/heads/master is exactly the same as the one returned by the $
git log command.
Search WWH ::




Custom Search