Information Technology Reference
In-Depth Information
The history of a git repository consists of a series of revisions. Each revision is a snap-
shot of the working directory at a particular point in time. The revisions are stored
within the .git/objects database.
Every revision is identified by its name . Git uses a SHA-1 algorithm to generate
names. Because the revision's SHA-1 is computed using many different types of
data—the author's name, the current timestamp, and the snapshot, among others—we
can treat them as unique identifiers. The probability that two different revisions will
have the same SHA-1 is so small that it can be disregarded. In fact, SHA-1 uniqness is
one of the most basic git assumptions. As you will see in chapter 11 . the whole process
of synchronization relies on it.
Hint The user cannot assign a name to the revision. All names are automatically
generated by git. Git rules here and you can trust that it will never generate two identical
names for different revisions.
SHA-1 names are 20 bytes long, and thus, their hex representation takes 40 charac-
ters, for example:
18cccd04a6f69018242bce96ef905bc5d3be6ff8
Later in the topic we will need to use the name as a parameter passed to various
commands; if that is the case, one will not have to use all 40 characters. Usually, the
first seven characters are sufficient. The shortest possible abbreviation of a name has to
be four characters long. Remember that abbreviation needs to be unique—if it is not,
then you'll have to use more characters.
The list of revisions stored in the repository can be printed with a git log com-
mand. Its various options and switches can be used to filter and reformat displayed re-
visions. The output of a git log command is sorted by the time the revisions were
created. The latest revision is displayed at the top of the output.
By default, the git log prints all revisions that are available from your current re-
vision.
The format of the output can be changed with the --pretty parameter. Available
values and their meanings are summarized in Table 2-3 .
Table 2-3 . The values for --pretty parameter
 
 
Search WWH ::




Custom Search