I been using git for years but never used diff command and I started to use it today but I really don't understand the output... I had a file and I removed line 3 and 4 and I got the following output but can someone help me understand what the lines of the output means in dummy terms. thanks
$ git diff
diff --git a/README.txt b/README.txt
index 15827f4..8115e72 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,2 @@
 this file
 adding like
-line 3
-
                Line 1: The command used to produce the diff.
Line 2: git database information for the two files involved.
Line 3 and 4: --- means old file, +++ means new file.
Line 5: @@ means the range of lines represented in the next diff hunk. -1,4 means lines 1-4 from the old file, and +1,2 means lines 1-2 in the new file.
The remaining lines are lines from the original files, prefixed with either  (a space), - or +.  lines are in both old and new, - are only in old and + are only in new. 
These are meant to be mnemonic: - are "removed lines",  are "unchanged lines", and + are "added lines".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With