Errata

Version Control with Git

Errata for Version Control with Git

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page Part II. Fundamentals of Git
'Lets examine the content of the object directory using some low level Git commands

Hi!

Noticed something small.

The same command is used both for checking the type of the object and the content of the object in a code snippet.

I think the '-t' flag is correct for the first command (checking the type) but the second command (checking the contents) should be '-p'

Note from the Author or Editor:
Thank you for catching this. It is now fixed. Appreciate the feedback :)

Cameron Samuell  Sep 12, 2022  Oct 21, 2022
Page Part II - Fundamentals of Git
Second page, second paragraph

After “Let’s examine the contents of the HEAD directory…” the command “cat .git/HEAD” is used. I think this shows the contents of the HEAD file, not the “refs/heads” directory (which is shown later).

Note from the Author or Editor:
fix:

replace the old sentence with the following:

Let's examine the contents of HEAD directory from the tree output.

to:

Let's examine the contents of HEAD from the tree output.

Ted  Feb 12, 2023 
Page Preface xiv-xv
Section showing examples from bottom of xiv to top of xv.

1. Multiple: > is printed (HTML/XML) instead of the correct glyph, >.
2. Multiple: Missing newline separating the comment (line beginning with #) from the command (line beginning with $).

Note from the Author or Editor:
Fix:

page xiv:
In the last two code snippet the following ">" needs to be replaced with ">" for every instance of it.

page xv:
the snippets below need a newline:

# install the Git core package
$ sudo apt-get install git-core

# edit file.c to have some new text
$ edit index.html

Larry Baker  Apr 10, 2023 
Page Chapter 1, page 6
Paragraph 3, last line

"preventing" is misspelled "preventiing".

Note from the Author or Editor:
fix:

"preventing" is misspelled "preventiing". Need to remove the double "i"

Larry Baker  Apr 15, 2023 
Page Chapter 1, Page 13
git commit example

The text of the log message is "Initial contents of my_website". The git response shown is "initial contents of my_website" (lower case "initial").

Note from the Author or Editor:
fix:

The git response code snippet should be changed to uppercase "i" for the word Initial

[main (root commit) c149e12] Initial contents of my_website

Larry Baker  Apr 15, 2023 
Page Chapter 1, Page 21
/etc/gitconfig description

"(perhaps in /usr/local/etc gitconfig)" should be "(perhaps in /usr/local/etc/gitconfig)" (missing "/").

Note from the Author or Editor:
fix:

"(perhaps in /usr/local/etc gitconfig)" should be "(perhaps in /usr/local/etc/gitconfig)" (missing "/")

Larry Baker  Apr 15, 2023 
Page Chapter 1, Page 21
Last paragraph

"user name" should be "user.name" (missing ".").

Note from the Author or Editor:
user.name code in the last paragraph needs to be fixed:

fix:
"user name" should be "user.name" (missing ".")

Larry Baker  Apr 15, 2023 
Page Chapter 1, Page 22
cat .git/config example output

It looks like "ignorecase = true" should be indented to line up with the lines preceding it.

Note from the Author or Editor:
Fix:

"ignorecase = true" should be indented to line up with the lines preceding it

Larry Baker  Apr 15, 2023 
Page Chapter 2, Page 27
The general note near the bottom

The first two sentences in this note are confusing; they seem contradictory. We don't find out until later (on page 46) that there are two kinds of tags, only one of which is in the object store. I suggest a rewording this note to something like:

"The four objects in the object store are immutable. Note that the tag object in the object store is called an annotated tag. We shall see later there is another type of tag, called a lightweight tag, which is not an immutable object, and thus is not in the object store, since it can be used as a reference that we can update directly."

Note from the Author or Editor:
Proposed fix:

"The four objects in the object store are immutable. Note that only an annotated tag is immutable and is the only type of tag which is stored in the object store. Later we will discuss about another type of tag, called a lightweight tag which is not an immutable object, and thus is not stored in the object store, since it can be used as a reference that we can update directly."

Larry Baker  Apr 15, 2023 
Page Chapter 2, Page 43
git commit-tree example

The bold "|" at the front of the git command should be a normal (not bold) "$".

Note from the Author or Editor:
The example snippet needs to be in one single line. The printed version is missing a new line prompt. The correct print out should be:

$ echo -n "Commit a file that says hello\n" \
| git commit-tree 492413269336d21fac079d4a4672e55d5d2147ac
3ede4622cc241bcb09683af36360e7413b9ddf6c

In the above code example, the first two lines need to be bold. The third line is not bold.

Larry Baker  Apr 15, 2023 
Page Page number 34-35. Visualizing the Git Object Store
Figure 2-5 and Figure 2-6

Hi,
I've noticed that the graphics of the figures 2-5 and 2-6 are interchanged. Figure 2-6 is supposed to show a visual representation after a second commit, but the graphic does only show a single commit structure. Instead, figure 2-5 shows a representation after a second commit.
Thanks!

Note from the Author or Editor:
Thank you for catching this Martin Hauser. Confirming and fixing this.

Martin Hauser  Oct 30, 2022  Nov 04, 2022
Page Page Page number 34. Visualizing the Git Object Store Figure 2-5
Figure 2-5

Hi,
the graphics for the visual representation of "Git objects after a second commit" (should be Figure 2-6, but is shown as Figure 2-5) has two technical mistakes.

Commit 1492 and 11235 contents has been interchanged. The text for commit 1492 should be the "initial commit", but list the content of the second commit (and vice versa).

Additionally the tree object ID of the second commit for the new blob is incorrect.
Tree object cafed00d lists the tree object ID 1010220, but the arrow shows the tree object ID 8675309 of the first commit.

Incorrect representation:
Commit 11235 --> tree cafed00d --> tree 8675309 --> blob 1010b

Correct representation:
Commit 11235 --> tree cafed00d --> tree 1010220 --> blob 1010b

Thanks!

Note from the Author or Editor:
The reported erratum is correct the diagrams (circles content) got interchanged

Martin Hauser  Oct 30, 2022  Nov 04, 2022
Page XV
The last 2 example commands listed for the "Conventions Used in This Book" section

2 examples under the "Conventions Used in This Book" section appear to be improperly formatted.

Both examples are missing a newline between the comment and the command

Problematic example 1 reads:
# Install the Git core package $ sudo apt-get install git-core

I believe it should read:
# Install the Git core package
$ sudo apt-get install git-core

Problematic example 2 reads:
# edit file.c to have some new text $ edit index.html

I believe that it should read:
# edit file.c to have some new text
$ edit index.html

Also in problematic example 2, the filename in the comment should be altered to match the filename in the edit command, or vice versa.

Note from the Author or Editor:
This is correct. The page layout will need to be updated with the correction.

Correction as suggested:

Typo 1:
# Install the Git core package $ sudo apt-get install git-core

Fix 1:
# Install the Git core package
$ sudo apt-get install git-core

Typo 2:
# edit file.c to have some new text $ edit index.html

Fix 2:
# edit file.c to have some new text
$ edit file.c

Peter Kukla  Nov 23, 2022  Feb 03, 2023
Page 27
"Tags" section

Text reads: "A tag object assign an yet presumably human-readable name to a specific object, usually a commit."

It feels as though there's a word or phrase missing between the "an" and the "yet" in that sentence. If not a typo, then re-wording the sentence would be helpful.

Note from the Author or Editor:
Proposed fix:

Typo:
Text reads: "A tag object assign an yet presumably human-readable name to a specific object, usually a commit."

Fix:
Text should read: "A tag object assign a presumably human-readable name to a specific object, usually a commit."

Peter Kukla  Nov 23, 2022  Feb 03, 2023
Page 43
Last paragraph before Figure 2-7

Text reads:

There are still only three unique objects: a blob containing "hello world"; one tree containing hello.txt, which contains the text "hello world" plus a new line; ..."

I interpret the "new line" in that sentence as as meaning "newline", i.e. a character, rather than "new line" i.e. an additional line added to the file as part of some steps we just walked through.

The text should probably be changed to more closely match the description of the file on page 38:

...the sequence of 12 bytes that preresent "hello world" and the terminating newline...

Note from the Author or Editor:
Good catch. The proposed fixed is as suggested.
The sentence needs to be changed as

There are still only three unique objects: a blob containing "hello world"; one tree containing hello.txt, which contains the text "hello world" plus a newline; ..."

Peter Kukla  Nov 25, 2022  Feb 03, 2023
Page 47
3rd paragraph

In sentence
"... where we learned about the various working directories Git replies upon,"
shouldn't it be "relies" instead of "replies"
"where we learned about the various working directories Git relies upon,"

Note from the Author or Editor:
fix:

From
"... where we learned about the various working directories Git replies upon,"

To:
"... where we learned about the various working directories Git relies upon,"

Marc Gras  Mar 21, 2023 
Page 94. Commit Graphs
Figure 4-7. Labeled commit graph

Hi,
I've notice that the arrow from node H to G in Figure 4-7 is pointing in the wrong direction. Node G and node D are both the parent commits of node H.
The arrow is correct in Figure 4-5 and Figure 4-6.

It is a minor detail. I really appreciate this book. Highly recommended!
Thank you!

Note from the Author or Editor:
The Arrow for node H to G needs to be reversed.

Wrong:
Arrow originating from G to H
G --> H

Correct:
Arrow originating from H to G
H --> G

Martin Hauser  Nov 04, 2022  Feb 03, 2023
Page 105. Importance of Index
TIP Box

Hi,
there is a small typo within the tip box. The command is "git diff --cached" instead of "git diff-cached".
Wrong:
"git diff --staged is a synonym for git diff-cached. [...]"

Correct:
"git diff --staged is a synonym for git diff --cached. [...]"

Thank you!

Note from the Author or Editor:
confirming typo where the double dash "--" got combined as a single "-"

Correct:
"git diff --staged is a synonym for git diff --cached.

Martin Hauser  Nov 06, 2022  Feb 03, 2023
Page 112
TIP Box

Hi, I found in TIP box, it said "For convenience, Git allows you to combine the two steps, git add and git commit , when you change an existing tracked file in the
repository: $ git commit -m trackedfile"

However, the command is not working. I think the correct one should be:
$ git commit -am <commit message>.

Therefore:
Wrong:
$ git commit -m trackedfile

Correct:
$ git commit -am <commit message>

Note from the Author or Editor:
Fix:

Wrong:
$ git commit -m trackedfile

Correct:
$ git commit -am trackedfile

Lei Lei  Mar 15, 2023 
Page 113. Using git rm
1st command

Hi,
in the section of "Using git rm" the SHA-1 value of "Random stuff" is listed as 6bece861cc8fd34181e6d43264acfe1503486538, but this is the SHA-1 value of "random stuff" (lower case "r").

Either the first command should be changed to
$ echo "random stuff" > oops

or the SHA-1 listings need to change to fcd87b055f261557434fa9956e6ce29433a5cd1c (SHA-1 of "Random stuff").

Thank you!

Note from the Author or Editor:
Correction:

On Page 113, the code snippet needs to be changed

From
$ echo "Random stuff" > oops <--- (Needs correction)

To
$ echo "random stuff" > oops. <---(Suggested correction to yield the correct SHA ID)

Martin Hauser  Nov 06, 2022  Feb 03, 2023
Page 116. Using git mv
Command Output

Hi,
I've noticed that the hash value of *data* has changed from the section "Using git rm" to the section "Using git mv", although the content of the file has not been modified.

The content of *data* (seen on page 115)
"New data
And some more data now"
leads to the correct SHA-1 value of e476983f39f6e4f453f0fe4a859410f63b58b500.

But on page 116 the value has suddenly changed to 534469f..., although the section "Using git mv" is picking up from the previous section without any modification to the content of the file.
Since the section emphases that git is keeping the original content, even if the file is moved / renamed, I assume it may be important to keep the SHA-1 value of the example of *data* inline with the previous section.

Thank you!

Note from the Author or Editor:
The correction should be done on page 116 as follows:

Mainly replacing the SHA1-ID for the data/mydata
From
534469f67ae5ce72a7a274faf30dee3c2ea1746d
To
e476983f39f6e4f453f0fe4a859410f63b58b500


Code block:

# Check the index before renaming file
$ git ls-files --stage
100644 0487f44090ad950f61955271cf0a2d6c6a83ad9a 0 .gitignore
100644 e476983f39f6e4f453f0fe4a859410f63b58b500 0 data

$ git mv data mydata

$ git status
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
renamed: data -> mydata

# Check the index with the renamed file
# Note that the SHA1 ID remains the same with the new pathname
$ git ls-files --stage
100644 0487f44090ad950f61955271cf0a2d6c6a83ad9a 0 .gitignore
100644 e476983f39f6e4f453f0fe4a859410f63b58b500 0 mydata

$ git commit -m "Moved data to mydata"
[main 4b7a819] Moved data to mydata
1 file changed, 0 insertions(+), 0 deletions(-)
rename data => mydata (100%)

Martin Hauser  Nov 06, 2022  Feb 03, 2023
Page 135. Chapter 6. git diff with conflicts.
Figure 6-2 merged diff side by side

Hi,
in Figure 6-2 the combined diff has an alignment issue with + of "worlds", which should be in the second column. (This is listed correctly as text on page 133.)

Wrong:
$ git diff
diff --cc hello
index e63164d,562080a..0000000
--- a/hello
+++ b/hello
@@@ -1,3 -1,3 +1,7 @@@
hello
++<<<<<<< HEAD
+ worlds
++=======
+ world
++>>>>>>> alt
Yay!

Correct:
$ git diff
diff --cc hello
index e63164d,562080a..0000000
--- a/hello
+++ b/hello
@@@ -1,3 -1,3 +1,7 @@@
hello
++<<<<<<< HEAD
+worlds
++=======
+ world
++>>>>>>> alt
Yay!


Thank you!

Note from the Author or Editor:
Correct Fix as per suggestion. The error has a typo where the spacing was left out.

Martin Hauser  Dec 11, 2022  Feb 03, 2023
Page 160. Chapter 7. Forms of the git diff Command
3rd paragraph, Figure 7-1

Hi,
I've noticed that the object ID of file1 in the index differs between the text (3rd paragraph on page 160) and the Figure 7-1.
Text: bd71363
Figure: db7163

Thank you!

Note from the Author or Editor:
The correct Object ID should be

Text: db71363
Figure: db71363

The correction needs to be in the paragraph to reflect object ID in Figure 7-1 of page 160

Martin Hauser  Nov 13, 2022  Feb 03, 2023
Page 254
6th paragraph

In
"As a convenience, the .git suffix is not required; both /tmp/Depot/my_html and /tmp/
Depot/my_website.git will work."

"my_html" should be changed as "my_website", like this :
"As a convenience, the .git suffix is not required; both /tmp/Depot/my_website and /tmp/
Depot/my_website.git will work."

Note from the Author or Editor:
Fix:

From
"As a convenience, the .git suffix is not required; both /tmp/Depot/my_html and /tmp/
Depot/my_website.git will work."

To
"As a convenience, the .git suffix is not required; both /tmp/Depot/my_website and /tmp/
Depot/my_website.git will work."

Marc Gras  Mar 23, 2023 
Page 272. Chapter 11. Part III. Pushing a Merged History
Figure 11-8. Merged histories after push

Hi,
the ref of "origin/main" should point to the merged commit "M" after git push in Figure 11-8 (in "Yours" / local repository).

Thank you!

Note from the Author or Editor:
Diagram needs updating.

Fix:
In the "Yours" section the "origin/main" ref needs to be pointing to the merge commit labelled "M"

Martin Hauser  Dec 11, 2022  Feb 03, 2023
Page 357. Chapter 15. Cloning a repository
Last clone operation

Hi,
in the last paragraph on Page 357 the clone source URL shows "superproject" instead of "superproject-upstream" as other clone examples. Although this is not wrong, I think it would be more inline with the other clone operations.

Suggestion:
git clone --recurse-submoules /tmp/superproject-upstream superproject-clone

Thanks!

Note from the Author or Editor:
This is a good suggestion. Initial code snippet was meant to be generic when referring to the label "superproject"

Old code snippet:
$ git clone --recurse-submodules /tmp/superproject superproject-clone

New suggested code snippet:
$ git clone --recurse-submodules /tmp/superproject-upstream superproject-clone

Martin Hauser  Dec 11, 2022  Feb 03, 2023
Page 458. Chapter 18. Issues
1st paragraph

Hi,
there is a small typo in the first paragraph:
"[...] customizing the iissue [...]"

Thank you for this great book!

Note from the Author or Editor:
The word "issue" was misspelled.


Typo:
"You can keep up with the progress on the issue by subscribing or customizing the iissue notification settings as shown in Figure 18-21."

Fix:
You can keep up with the progress on the issue by subscribing or customizing the issue notification settings as shown in Figure 18-21.

Martin Hauser  Dec 11, 2022  Feb 03, 2023