2

I was in branch1. I committed a few files using git command:

git add file1.c

git commit

And then created patch using git format-patch:

git format-patch master..branch1

Now the patch created has these lines on the top:

diff --git a/include/abc.h b/include/abc.h
index 2f5f1f3..f4aa268 888111
--- a/include/abc.h
+++ b/include/abc.h

My questions are:

  1. What does line index 2f5f1f3..f4aa268 888111 mean?

  2. I think it might be related to some git hash. How can I verify those numbers from the git log? Basically what those numbers mean in index 2f5f1f3..f4aa268 888111?

  3. git log shows very long numbers in the hash. How are they related, if at all?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Have you tried searching for index in the format-patch docs? – jthill Apr 02 '20 at 17:59
  • I've marked this as a duplicate though it's not precisely a duplicate because of your question #3. The thing to know about Git hash IDs is that you can *abbreviate* them, as long as the shortened one is unambiguous. Git sometimes shows you the full hash (which always works) and sometimes shortens them on its own. The blob hashes in the `index` line are shortened unless you use the `--full-index` option when making the diff. – torek Apr 02 '20 at 18:59

0 Answers0