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.

MrJobs (4) [Avatar] Offline
Consider "Listing 6.5. git diff (between working area and staging area)" from the book.

diff --git a/ b/
index 964c002..5bb7f63 100644
--- a/
+++ b/
@@ -1,4 +1,3 @@
# Comment
-echo $a

Does the following explain this line "@@ -1,4 +1,3 @@" correctly/roughly ?

The line starting with @@ is roughly saying take the original file/file in staging (a/ starting at the line 1 & going for 4 lines (-1,4). Then, apply the contents of the new file/file in working directory (b/ starting at line 1 & going for 3 lines (+1,3).
rickumali (134) [Avatar] Offline
Hi MrJobs!

Yes, your description of the "@@" line looks accurate. I'm no expert on the hunk format, and when I considered your question, I found myself looking carefully at these resources:


Check these out. The second link is written by the author of Python!
612816 (1) [Avatar] Offline

And I think that the command description is wrong. git diff (with no option) is comparing your working area with the repository history. That is not correct. Sorry.
You can test that by adding the file to the staging area (git add) or by reverting the file to the original content (git check out). In both situations, the working area will have the same content as the last commit (right?)
So if after that you do git diff you will have no result.
Does that make sense for you?
Thank you.