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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
ePub, Page Chapter 11
Section: Creating an Authoritative Repository

In chapter 11 of the latest edition of version control with git (the 3rd version, I believe), there is the following paragraph.

The remote establishes a link from your current repository to the remote repository found, in this case, at /tmp/Depot/my_website.git as recorded in the url value. As a convenience, the .git suffix is not required; both /tmp/Depot/my_html and /tmp/Depot/my_website.git will work.

I think that /tmp/Depot/my_html should be replaced with /tmp/Depot/my_website since nowhere else does the string my_html occur?

And if I were being picky, I would say that the recorded url value in the example states /tmp/Depot/my_website and not /tmp/Depot/my_website.git, though as the paragraph says either will work fine.

Anonymous  May 17, 2023 
Chapter 16
Retrieve an Old Version of a File

# In our example we have replaced the default branch name to main
# using the git branch -M command
$ git rev-list main -- date.c
974c919d36d944e9005def346fb363d8a83399f7
f1e9c548ce45005521892af0299696204ece286b
...
89967023da94c0d874713284869e1924797d30bb
ecee9d9e793c7573cf3730fb9746527a0a7e94e7
Uh, yeah, something like 120-odd lines of SHA1 commit IDs. Fun! But what does it all mean? And how do you use it?

Because we didn’t specify the -n 1 option, all matching commit IDs have been generated and printed. The default is to emit them in reverse chronological order. So this means commit ee646e contains the most recent version of the file date.c, and ecee9d9 contains the oldest version. In fact, looking at commit ecee9d9 shows the file being introduced into the repository for the first time:
--------------------------------------------------------------------------------------------
I think that commit ee646e is not the most recent version of the file date.c? I think the most recent version is 974c919d36d944e9005def346fb363d8a83399f7?

Robert Wilkinson  May 19, 2023 
Chapter 16
Recovering a Lost Commit

$ echo bar >> file
$ git add file
$ git commit -m "Add some bar"
[main 66919fa] Add some bar
1 files changed, 1 insertions(+), 0 deletions(-)

and

Here, the previously lost commit that introduced the bar content, 11e0dc9c, is re-introduced on the new branch called recovered:

$ git branch recovered 66919fae
$ git show-branch

* [main] Add some foo
! [recovered] Add some bar
--

+ [recovered] Add some bar
*+ [main] Add some foo
------------------------------------------------------------------------------------------
I think that "introduced the bar content, 11e0dc9c" should be "introduced the bar content, 66919fa"?

Robert Wilkinson  May 19, 2023 
Printed Page Page 43
Figure 2-7

The Figure 2-7, shows tree objects, the top tree object shows tree 49241 but in the brackets it shows the top level directory /tmp/hello and the next tree object shows tree 68aba but shows the directory /tmp/hello/subdir.

Shouldn't the directory names be interchanged i.e. tree 49241 as /tmp/hello and tree 68aba as /tmp/hello/subdir? The diagram seems to be confusing.

Gautam Bhat  Jun 18, 2023 
Printed Page Part II Fundamentals of Git page, Page 53 (not mentioned in printed version, manually calculated)
2nd paragraph

The git cat-file -p 16b23 mentioned shows the blob filename as "readme.md" which should be named "file". This is because in Pg 50 (manually calculated, page number not mentioned in the printed version), in the final paragraph the example creates a file name named "file" as echo "Hello Git" > file.

Gautam Bhat  Jun 23, 2023 
PDF Page xv
the last command example before first paragraph

There is a typo in the comment:

# Command to remove a file
$ rmdir newdirectory

SHOULD BE
# Command to remove a dirctory
$ rmdir newdirectory

ZHANG Hongyuan  Aug 25, 2023 
O'Reilly learning platform Page Chapter 4. Commits, Absolute Commit Names
example git log output

The example for the third invocation of the git log command has an output that does not match the requested commit id:

$ git log -1 --pretty=oneline 30cc8d
a5828ae6b52137b913b978e16cd2334482eb4c1f ... A regression fix for 2.37

Jens M. Felderhoff  Dec 21, 2023 
O'Reilly learning platform Page Chapter 7: Forms of the git diff Command
Figure 7-1. Various file versions that can be compared

The labels for the files in the upper part of the figure showing the working directory show "file1" for the file with content "quux" and "file2" for the file with content "bar".

The tree object (triangle) in the index/staging area, however, links the blob with content "bar" to the name "file1" and the uncommitted dashed blob with content "quux" to the name "file2".

Jens M. Felderhoff  Jan 03, 2024 
O'Reilly learning platform Page Chapter 7: Forms of the git diff Command
12th paragraph describing git diff options

The synopsis of the --word-diff option is wrong it shows an extraneous equals sign before the square bracket around the optional specification: "--word-diff=[=mode]" instead of the correct synopsis
"--word-diff[=mode]".

Jens M. Felderhoff  Jan 04, 2024 
O'Reilly learning platform Page Chapter 7: Forms of the git diff Command
Figure 7-2. git diff output

The command at the prompt shows
$ Git diff file3
it should be lowercase:
$ git diff file3

Jens M. Felderhoff  Jan 04, 2024 
O'Reilly learning platform Page Chapter 9: Altering Commits, rebase Versus merge
git log command output before "Figure 9-25. git rebase merge after linearization"

The command is "git log --oneline --all", however graphical output is shown without the "--graph" option.

Jens M. Felderhoff  Jan 04, 2024 
O'Reilly learning platform Page Chapter 10: The Stash and the Reflog, Use Case: Interrupted Workflow
Description of Figure 10-1. Stash concepts

Files file1, file2, and file3 are popped from stash entry stash@{2}, *not* stash@{0}.

Jens M. Felderhoff  Jan 05, 2024 
O'Reilly learning platform Page Chapter 11. Remote Repositories/Part II: Example Using Remote Repositories/Getting Repository Update
Example for refspec exclusion

The remote names of the example code and the describing text differ. The example commandline reads "git fetch newdev refs/heads/*:refs/remotes/newdev/* ^refs/heads/skip-me", however, the text description says "The preceding code will locally fetch all branches in the repository into remotes/origin but will exclude fetching the branch with the matching name skip-me."

Jens M. Felderhoff  Jan 08, 2024 
Printed Page 9
First code example under "Preparing to Work with Git"

As you follow along the various commands, the following command...

PS C:\temp> git config user.name "Jon Loeliger"

... will yield...:

fatal: not in a git directory


... as at this stage in the book, n repository has been created yet. It'd be best to mention this config setting after being introduced on how to create a repo.

Christian Menage  Feb 23, 2024 
PDF Page 167
Figure 7-2

Hi There,

The Figure 7-2 is not consistent with the example above . by executing echo -e "Line1 \nLine2 \nLine3 \nLine4 \nLine5" >> file3.

there will be a space after each line(except Line5). then as request, I removed Line3 and add new Line6 and Line7. But it does not mentioned that I should also delete the space character after Line1 Line2 and Line4 . so the diff output of mine is :

diff --git a/file3 b/file3
index 3c4db46..56d6bcd 100644
--- a/file3
+++ b/file3
@@ -1,5 +1,6 @@
Line1
Line2
-Line3
Line4
Line5
+Line6
+Line7

indicating that Line1 Line2 and Line4 Line5 stay not changed and Line3 is deleted.

However, what's in the Figure 7-2 is actually indicating that Line1 to Line4 are changed(there is a space but you can not see it in the book without having some sort of coloring)

AI Lingfeng  May 13, 2023 
Printed Page 199
Table 9-1

In Table 9-1 "git reset option effects", there are 3 incorrect values for "Yes" or "No" in the first two rows of the table:

Row --soft should be: "Yes No No" (it's printed as "Yes Yes No")
Row --mixed should be: "Yes Yes No" (it's printed as "Yes No Yes")

Troy DeJongh  Oct 01, 2023