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

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

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/math.sh) starting at the line 1 & going for 4 lines (-1,4). Then, apply the contents of the new file/file in working directory (b/math.sh) starting at line 1 & going for 3 lines (+1,3).
rickumali (130) [Avatar] Offline
#2
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:

1 https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
2 https://www.artima.com/weblogs/viewpost.jsp?thread=164293

Check these out. The second link is written by the author of Python!