Skip to content

Commit f0ad3ac

Browse files
committed
More minor tweaks and rewording for "Git References" section
1 parent ec2a0c7 commit f0ad3ac

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

book/10-git-internals/sections/refs.asc

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[[_git_refs]]
22
=== Git References
33

4-
You can run something like `git log 1a410e` to look through your whole history, but you still have to remember that `1a410e` is the last commit in order to walk that history to find all those objects.
5-
You need a file in which you can store the SHA-1 value under a simple name so you can use that pointer rather than the raw SHA-1 value.
4+
If you were interested in seeing the history of your repository reachable from commit, say, `1a410e`, you could run something like `git log 1a410e` to display that history, but you would still have to remember that `1a410e` is the commit you want to use as the starting point for that history.
5+
Instead, it would be easier if you had a file in which you could store that SHA-1 value under a simple name so you could use that simple name rather than the raw SHA-1 value.
66

7-
In Git, these are called ``references'' or ``refs''; you can find the files that contain the SHA-1 values in the `.git/refs` directory.
7+
In Git, these simple names are called ``references'' or ``refs''; you can find the files that contain those SHA-1 values in the `.git/refs` directory.
88
In the current project, this directory contains no files, but it does contain a simple structure:
99

1010
[source,console]
@@ -33,8 +33,7 @@ cac0cab538b970a37ea1e769cbbde608743bc96d second commit
3333
fdf4fc3344e67ab068f836878b6c4951e3b15f3d first commit
3434
----
3535

36-
You aren't encouraged to directly edit the reference files.
37-
Git provides a safer command to do this if you want to update a reference called `update-ref`:
36+
You aren't encouraged to directly edit the reference files; instead, Git provides the safer command `git update-ref` to do this if you want to update a reference:
3837

3938
[source,console]
4039
----
@@ -91,7 +90,7 @@ ref: refs/heads/test
9190

9291
When you run `git commit`, it creates the commit object, specifying the parent of that commit object to be whatever SHA-1 value the reference in HEAD points to.
9392

94-
You can also manually edit this file, but again a safer command exists to do so: `symbolic-ref`.
93+
You can also manually edit this file, but again a safer command exists to do so: `git symbolic-ref`.
9594
You can read the value of your HEAD via this command:
9695

9796
[source,console]
@@ -100,7 +99,7 @@ $ git symbolic-ref HEAD
10099
refs/heads/master
101100
----
102101

103-
You can also set the value of HEAD:
102+
You can also set the value of HEAD using the same command:
104103

105104
[source,console]
106105
----
@@ -119,10 +118,10 @@ fatal: Refusing to point HEAD outside of refs/
119118

120119
==== Tags
121120

122-
We just finished discussing Git's three main object types, but there is a fourth.
123-
The _tag_ object is very much like a commit object it contains a tagger, a date, a message, and a pointer.
121+
We just finished discussing Git's three main object types (_blobs_, _trees_ and _commits_), but there is a fourth.
122+
The _tag_ object is very much like a commit object -- it contains a tagger, a date, a message, and a pointer.
124123
The main difference is that a tag object generally points to a commit rather than a tree.
125-
It's like a branch reference, but it never moves it always points to the same commit but gives it a friendlier name.
124+
It's like a branch reference, but it never moves -- it always points to the same commit but gives it a friendlier name.
126125

127126
As discussed in <<_git_basics_chapter>>, there are two types of tags: annotated and lightweight.
128127
You can make a lightweight tag by running something like this:
@@ -132,10 +131,10 @@ You can make a lightweight tag by running something like this:
132131
$ git update-ref refs/tags/v1.0 cac0cab538b970a37ea1e769cbbde608743bc96d
133132
----
134133

135-
That is all a lightweight tag is a reference that never moves.
134+
That is all a lightweight tag is -- a reference that never moves.
136135
An annotated tag is more complex, however.
137136
If you create an annotated tag, Git creates a tag object and then writes a reference to point to it rather than directly to the commit.
138-
You can see this by creating an annotated tag (`-a` specifies that it's an annotated tag):
137+
You can see this by creating an annotated tag (using the `-a` option):
139138

140139
[source,console]
141140
----
@@ -150,7 +149,7 @@ $ cat .git/refs/tags/v1.1
150149
9585191f37f7b0fb9444f35a9bf50de191beadc2
151150
----
152151

153-
Now, run the `cat-file` command on that SHA-1 value:
152+
Now, run `git cat-file -p` on that SHA-1 value:
154153

155154
[source,console]
156155
----
@@ -173,7 +172,7 @@ You can view the public key by running this in a clone of the Git repository:
173172
$ git cat-file blob junio-gpg-pub
174173
----
175174

176-
The Linux kernel repository also has a non-commit-pointing tag object the first tag created points to the initial tree of the import of the source code.
175+
The Linux kernel repository also has a non-commit-pointing tag object -- the first tag created points to the initial tree of the import of the source code.
177176

178177
==== Remotes
179178

0 commit comments

Comments
 (0)