Skip to content

Instantly share code, notes, and snippets.

@jakeboxer
Last active January 3, 2016 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakeboxer/8448927 to your computer and use it in GitHub Desktop.
Save jakeboxer/8448927 to your computer and use it in GitHub Desktop.
# Directory structure
.
├── README.md
└── lib
├── a.rb
├── b.rb
└── c.rb
# Blob SHAs:
README.md's SHA is 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
lib/a.rb's SHA is e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98
lib/b.rb's SHA is 84a516841ba77a5b4648de2cd0dfcb30ea46dbb4
lib/c.rb's SHA is 3c363836cf4e16666669a25da280a1865c2d2874
# lib/ tree contents (this is a single three-line string):
100644 blob e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 a.rb
100644 blob 84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 b.rb
100644 blob 3c363836cf4e16666669a25da280a1865c2d2874 c.rb
# Get the lib/ tree SHA by running the SHA function on the lib/ tree contents string
SHA("100644 blob e9d71f5...") = 8a32db017de1bbb8d323f38c7c483bccffa915ed
# root tree contents (this is a single two-line string):
100644 blob 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 README.md
040000 tree 8a32db017de1bbb8d323f38c7c483bccffa915ed lib
# Get the root tree SHA by running the SHA function on the root tree contents string
SHA("10644 blob 86f7e43..." = 0f120cd8a791f9b752d57d903cea58f4bc3828b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment