Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Raw Git

Raw Git

A quick presentation covering some of the basics of working with Git objects in Ruby.

70bd372389add5e121b7a9a929b2d887?s=128

Scott Sanders

May 05, 2014
Tweet

Transcript

  1. Raw Git Underneath the porcelain and plumbing

  2. None
  3. What is git? • Distributed Version Control System • A

    content addressable filesystem • OMG It’s full of SHA1 hashes! • With some reference logs to these hashes That’s pretty much it...
  4. git in 15 seconds

  5. None
  6. None
  7. None
  8. None
  9. None
  10. None
  11. wtf just happened?

  12. None
  13. so many files. ermahgerd.

  14. None
  15. its just a graph, really

  16. with three main objects

  17. “files” blobs

  18. “directories” trees

  19. “references to trees” commits

  20. and a reference log

  21. None
  22. … because its easy let’s do this by hand

  23. None
  24. None
  25. None
  26. “blob” SP <length> NUL

  27. None
  28. None
  29. None
  30. None
  31. None
  32. None
  33. None
  34. None
  35. None
  36. does git work now? we made a blob!

  37. None
  38. None
  39. None
  40. NOPE!

  41. we need our tree

  42. “tree” SP <length> NUL <mode> <name> NUL <sha>

  43. None
  44. None
  45. None
  46. None
  47. None
  48. None
  49. None
  50. None
  51. None
  52. does git work yet? now we have a tree!

  53. None
  54. None
  55. None
  56. NOPE!

  57. still need the commit

  58. “commit” SP <length> NUL “tree <sha>” LF “author <name> <timestamp>”

    LF “committer <name> <timestamp>” LF LF “<message>” LF
  59. None
  60. None
  61. None
  62. None
  63. None
  64. None
  65. None
  66. None
  67. lol typo

  68. None
  69. does git work now?!? ok, we have our objects

  70. None
  71. None
  72. None
  73. NOPE!

  74. what gives?

  75. AKA Let’s glue it all together that pesky reflog

  76. None
  77. None
  78. None
  79. That’s it!

  80. None
  81. None
  82. None
  83. None
  84. None
  85. git is really simple

  86. and extremely flexible

  87. go build your own workflow!

  88. and don’t be scared to look under the hood

  89. Thanks!

  90. github.com/jssjr @scott_sanders