The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Magnum (7) [Avatar] Offline
Hi Rick, awesome Book! Thank you in advance for your help.

Lab 7.5.3 explores the "form" (pattern) for these two commands:

 git checkout --
git reset

My questions:
1. The Answers PDF (dated Jan 21, 2018 ), says "we omit double-dashes (for both commands of the Lab) and its use is not discussed in the Book". However, I clearly see "doubles dashes" right before
Why is the Book using "double-dashes" when it says it is omitting them? Maybe, I'm misunderstanding the line: "we omit double dashes"?
I believe, if double dashes are to be omitted for the scope of this Book, then the command:
"git checkout --" should be typed without double dashes like this: "git checkout"

2. Can I use "git checkout" (without double dashes) instead of "git checkout --"?
I read the Link. Thank you. I would think that the double dashes are ALWAYS recommended? (for most cases, to avoid confusion between trees and paths)

PS #1. Quote from Answers PDF:
Both commands specify -- as an optional argument. For both our commands,
we omit --
. These double-dashes are used to separate the tree-ish from the
paths. The book doesn’t discuss tree-ish, or a use-case involving --, but you
can visit this Stack Overflow URL for more.

PS #2. Other Double-dashes used in Ch 7:
The aforementioned Lab 7.5.3, the first command of the two: git checkout --
Also, the TRY IT NOW 7.4.6: git checkout --
Also, the Page 8 of Answers PDF, for step #3 of Lab 7.5.1 "Now check out the latest code": git checkout -- lorem-ipsum.txt
rickumali (134) [Avatar] Offline
My answers:

1. Yes, you're correct! I should have removed this "--" from the book. The few times the "--" is printed is because it is a part of the output of standard Git commands like 'git status', but I admit leaving it in the sections that you list.

The appearance of "--" in the Git output messages is why I call it out in the answer guide. Git commands have many different forms, and using "--" is one of them. The answer guide (and specifically that Stack Overflow link) offers the details behind this rational. The goal of this exercise is to recognize that there are different ways to call a Git command.

2. Yes, you can use "git checkout" (without double dashes) instead of "git checkout --". Keep this in mind as you explore Chapter 8, when we use 'git checkout' without "--". Same command, different form! The Stack Overflow link references "Argument Disambiguation" from the 'git checkout' help. Check it out for more details.