1

I basically have 3 questions:

  1. Which is better to use and why? git format-patch or git bundle?
  2. What all metadata is used by GIT to calculate SHA-1 key for commit and blobs/trees?
  3. When I apply a patch which was created by format-patch, why does it have different SHA for same changes and commit?
Mudassir Razvi
  • 1,783
  • 12
  • 33
  • if you have three questions, you might want to ask three questions (rather than cramming everything into a single question) – umläute Jun 03 '14 at 11:13

1 Answers1

1
  1. this obviously depends on your use-case; git bundle only makes sense if you transfer a changeset from one git-repository to another, whereas git format-patch creates standard diff-files which can be inspected easily and applied to a non-gitified source tree as well. on the other hand git bundle creates a single file, which is easier to transport than the multi-file output of git format-patch

  2. this is possibly a duplicate of Is SHA-1 calculated based on content?

  3. see #2

Community
  • 1
  • 1
umläute
  • 28,885
  • 9
  • 68
  • 122
  • Thank You! Makes sense. So blob(file) SHA is purely based on content and no meta data is involved. Tree SHA has details like parent, top of tree etc which contribute to SHA(what else does) And for commit committer and authot name, email and time stamp are involved in SHA.(Apart fro this what else is used to calculate SHA) – Mudassir Razvi Jun 03 '14 at 11:14