Information Technology Reference
In-Depth Information
mand $ git prune then the two revisions b and c will be eventually lost. Let's do
that. Execute the command:
$ git prune
If you now try to reset the repository to the revision c using its name:
$ git reset --hard 5c1e
you will get the error:
fatal: ambiguous argument '5c1e': unknown revision or
path not in the working tree.
The revision is not accessible any more. You have just lost it! Forever!
Hint You can list all inaccessible objects that are stored in a database with $ git
fsck --unreachable .
How It Works
Git stores all the revisions in the repository's database .git/objects . This database
uses SHA-1 hashes to identify revisions, files, and all other entries. It is a content ad-
dressable storage, which means that the keys are generated using the contents of stored
data. From time to time, the database is cleared and the objects that are not accessible
through symbolic references are eventually removed. To get familiar with this process
we need to dive deeper into the structure of a repository.
In the previous chapter we divided the git repository into:
• The git directory .git/
• The database .git/objects
• The working directory
The contents of the database can be further classified into:
Search WWH ::




Custom Search