2

In the output of git diff, what do the first two lines mean?

Specifically, in the following two examples:

What do diff --git a/file b/file and diff --cc file mean? I thought they mean that git diff is invoking diff, but does diff have options --git and --cc (man diff doesn't show them)?

What do index a29c52b..802acf8 100644 and index 4d77dd1,802acf8..0000000 mean? (Is index followed by a range of commits and a commit?)

$ git diff
diff --git a/file b/file
index a29c52b..802acf8 100644
--- a/file
+++ b/file
@@ -2,3 +2,5 @@ Line 1 stuff
 Line 2 stuff
 Line 3 stuff
 Line 4 alternate stuff
+Line 5 alternate stuff
+Line 6 alternate stuff

$ git diff
diff --cc file
index 4d77dd1,802acf8..0000000
--- a/file
+++ b/file
@@@ -2,5 -2,5 +2,10 @@@ Line 1 stuf
  Line 2 stuff
  Line 3 stuff
  Line 4 alternate stuff
++<<<<<<< HEAD:file
 +Line 5 stuff
 +Line 6 stuff
++=======
+ Line 5 alternate stuff
+ Line 6 alternate stuff
++>>>>>>> alternate:file
halfer
  • 19,824
  • 17
  • 99
  • 186
Tim
  • 1
  • 141
  • 372
  • 590

0 Answers0