Information Technology Reference
In-Depth Information
Right now the master branch is stored in loose format. The information about its
latest revision is saved in a text file .git/refs/heads/master . If you want to
convert the format of all the references from loose to packed format you can use the
following command:
$ git pack-refs --all
After the above command, the .git/refs/heads directory becomes empty
again; however it doesn't mean that the branch was removed. The repository still con-
tains this branch. You can verify it with the $ git branch command. However, the
tip of the master branch is stored in the .git/packed-refs file in packed
format.
Hint The last commit in a branch is called the tip of the branch. Figure 5-1 presents
three branches with following tips: the tip of the branch doc is d3 , the tip of the branch
master is m3 , and the tip of the branch info is i3 .
After the next commit created with:
$ echo m2 > m2.txt
$ git snapshot m2
the file .git/HEAD remains unchanged but the format for storing the master
branch is changed from packed to loose again. The file .git/refs/heads/mas-
ter is recreated and it now contains the SHA-1 of the revision labeled m2 . You can
check it using the same two commands used previously:
$ git log --pretty=oneline
$ cat .git/refs/heads/master
You should notice that every revision converts the format of a branch from packed
to loose.
The third revision labeled m3 leaves the file .git/HEAD intact while .git/
refs/heads/master contains the SHA-1 of the third revision.
Search WWH ::




Custom Search