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

gitの裏側をさぐる

Dcebc7211303cb2ad89d7b011af920a1?s=47 Marina Nakagawa
April 19, 2018
300

 gitの裏側をさぐる

新人研修で喋った内容です

Dcebc7211303cb2ad89d7b011af920a1?s=128

Marina Nakagawa

April 19, 2018
Tweet

Transcript

  1. 1 ͷཪଆΛ͙͞Δ ΞϓϦνʔϜ த઒ສᣦಸ

  2. 2 Marina Nakagawa @marina10172013 ೔ຊܦࡁ৽ฉࣾͷiOSΤϯδχΞ ిࢠ൛ΞϓϦɼࢴ໘ϏϡʔΞʔΞϓϦͷ։ൃ

  3. 3 git࢖͑ΔΑ͏ʹͳ͖͚ͬͯͨͲɾɾɾ தͰԿ͕ى͍ͬͯ͜Δͷ͔Θ͔Βͳ͍ਓ ର৅ऀ ͋ͷ਺ࣈͱจࣈͷཏྻ͕Կ͔Θ͔Βͳ͍ਓ

  4. 4 ϋογϡ஋ΛݟͯΈΑ͏ SHA-̍ϋογϡ஋ $git log ϑΝΠϧ಺༰ʹج͍ͮͯܭࢉ͞ΕΔ160Ϗοτʹ ू໿͞ΕΔϥϯμϜͳ஋

  5. 5 Ͳ͏΍ͬͯόʔδϣϯ؅ཧ͕Ͱ͖Δͷʁ

  6. 6 ͨΊͯ͠ΈΑ͏ $mkdir test-git σΟϨΫτϦΛ࡞Δ $cd test-git test-gitͷதʹ͸͍Δ $ls -A

    தͷϑΥϧμΛݟΔ ·ͩԿ΋ೖ͍ͬͯ·ͤΜ
  7. 7 ͨΊͯ͠ΈΑ͏ $git init Initialized empty Git repository in /Users/nakagawa/Projects/test-git/.git/

    GitΛ࢖͑ΔΑ͏ʹ͢Δ $ls -A ϑΥϧμͷத਎ΛݟΔ .gitϑΝΠϧ͕Ͱ͖͍ͯ·͢
  8. 8 ͨΊͯ͠ΈΑ͏ $ls .git HEAD config hooks objects branches description

    info refs .gitϑΝΠϧͷத਎ΛݟͯΈ·͠ΐ͏
  9. 9 ৽͘͠ϑΝΠϧΛ࡞ͬͯaddͯ͠ΈΑ͏ $echo 'hello' > README READMEϑΝΠϧΛͭ͘Γ·͢ $git add README

    READMEϑΝΠϧΛadd͠·͢ Index͕௥Ճ͞Εͨʂ $ls -A .git
 HEAD config hooks info refs branches description index objects .gitͷϑΝΠϧͷத਎ΛݟͯΈΔ
  10. 10 ͓·͚ .git/indexͬͯԿʁ

  11. 11 .git/indexͬͯͳΜͩΖ͏ʁ $git ls-files -s ΠϯσοΫεͷΦϒδΣΫτ໊ɺmode bitsɺstage number Λදࣔͤ͞ΔίϚϯυΛ࢖͏ ϑΝΠϧܕ

    SHA-1ϋογϡ஋ εςʔδ਺ ϑΝΠϧ໊ 100644 ce013625030ba8dba906f756967f9e9ca394464a 0 README ϑΝΠϧܕͷ100644͸README͕௨ৗͷϑΝΠϧͰ͋Δ͜ͱΛࣔ͢ εςʔδ਺͸Ϛʔδ͢Δͱ͖ͷڝ߹ͷঢ়ଶ
 (ڝ߹͕͋Δͱ̍Ҏ্ͷεςʔδ਺ 0ͩͱڝ߹ͳ͠) SHA-1ϋογϡ஋͸ϑΝΠϧ಺༰ʹج͍ͮͯܭࢉ͞ΕΔ160Ϗοτʹू໿͞ΕΔϥϯμϜͳ஋ ಺༰͕ҰจࣈͰ΋ҧ͏ͱผͷ஋ʹͳΔ catͰΈͯ΋Α͘Θ͔Βͳ͍ͷͰ
  12. 12 ΄Μͱʹҧ͏஋ʹͳΔͷʁ $echo 'hello!' > README $git add README $git

    ls-files -s READMEʹॻ͍ͨHelloΛHelle!ͱʂΛ଍ͯ͠ΈΑ͏ ϑΝΠϧܕ SHA-1ϋογϡ஋ εςʔδ਺ ϑΝΠϧ໊ 100644 4effa19f4f75f846c3229b9dbdbad14eff362f32 0 README ͔ͨ͠ʹ಺༰͕ҰจࣈͰ΋ҧ͏ͱผͷ஋ʹͳΔ
  13. 13 Ͳ͏ͯ͠ϋογϡ஋Λ࢖͏ͷʁ όʔδϣϯ؅ཧγεςϜ͸ಉҰϑΝΠϧͷ಺༰ͷมԽΛ௥੻͢Δ΋ͷ͔ͩΒ ϑΝΠϧ಺༰͕ಉ͡Ͱ͋Ε͹ͲΜͳ؀ڥͰ͋ͬͯ΋ಉ͡஋ʹͳΔ ͷ͕౎߹͕͍͍ ϋογϡ஋͕ಉ͡=ϑΝΠϧ಺༰͕ಉ͡

  14. 14 Ͳ͏΍ͬͯϋογϡ஋Λܭࢉ͢Δͷʁ SHA-1ϋογϡ஋ = ϔομʔ৘ใʴϑΝΠϧͷ಺༰ ϔομʔ৘ใͱ͸ ϔομʔ৘ใɿ֨ೲ͢ΔΦϒδΣΫτܕͱϑΝΠϧ಺༰ͷαΠζ ΦϒδΣΫτܕͱ͸ ϑΝΠϧ͸blobɺϑΥϧμ͸treeͱ͍͏ΦϒδΣΫτܕʹͳΔ

  15. 15 Ͳ͏΍ͬͯϋογϡ஋Λܭࢉ͢Δͷʁ ࠓճͷྫͩͱ (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello! $echo 'hello!'

    | git hash-object --stdin
 gitͷػೳͰϋογϡ஋Λग़ͯ͠ΈΔ ಉ͡஋ͩʂ ͜ͷ৘ใΛ࢖ͬͯSHA-1ϋογϡ஋Λग़ͤΔ
  16. 16 ͜ͷϋογϡ஋ΛͲ͏࢖͍ͬͯΔͷʁ .git/objectsͷத਎ΛݟͯΈ·͠ΐ͏ $find .git/objects
 ϋογϡ஋ͷ࠷ॳͷೋจࣈ͸αϒϑΥϧμ໊ɺ࢒Γͷ38จࣈ͸ϑΝΠϧ໊ͱ ͨ͠ύεʹʮblob 7 hello!ʯ͕อଘ͞Ε͍ͯΔ

  17. 17 ͜ͷϋογϡ஋ΛͲ͏࢖͍ͬͯΔͷʁ ϋογϡ஋ͷύεΛݟͯΈ·͠ΐ͏ $cd .git/objects
 $vi 4e/ffa19f4f75f846c3229b9dbdbad14eff362f32
 ͳʹ͜Εɾɾʁຊ౰ʹʮHello!ʯͳͷ? zlibͰѹॖ͞Εͯ͠·͏ͨΊจࣈ͸֬ೝͰ͖ͳ͍ͷͰͨ͠ɾɾɾ
 (zlib͸ɺσʔλͷѹॖ͓Αͼ৳ுΛߦ͏ͨΊͷϑϦʔͷϥΠϒϥϦ)

  18. 18 ͜ͷϋογϡ஋ΛͲ͏࢖͍ͬͯΔͷʁ ѹॖͨ͠σʔλΛղಡͯ͠ΈΑ͏ $git cat-file -t 4effa
 -t :λΠϓʢΦϒδΣΫτܕʣΛදࣔ ϋογϡ஋

    (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello!
  19. 19 ͜ͷϋογϡ஋ΛͲ͏࢖͍ͬͯΔͷʁ ѹॖͨ͠σʔλΛղಡͯ͠ΈΑ͏ $git cat-file -s 4effa
 -s :αΠζΛදࣔ ϋογϡ஋

    (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello!
  20. 20 ͜ͷϋογϡ஋ΛͲ͏࢖͍ͬͯΔͷʁ ѹॖͨ͠σʔλΛղಡͯ͠ΈΑ͏ $git cat-file -p 4effa
 -p :಺༰Λදࣔ ϋογϡ஋

    (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello! ͪΌΜͱσʔλ͕͍Δ
  21. 21 Commitͯ͠ΈΑ͏

  22. 22 ίϛοτ͢ΔͱͲ͏ͳΔͷʁ ίϛοτͯ͠ΈΑ͏ $git commit -m "1st commit" 
 .git/objectsͷத਎ΛݟͯΈ·͠ΐ͏


    (ݕࡧର৅ΛϑΝΠϧͷΈʹݶఆͯ͠ݕࡧ͢ΔΦϓγϣϯΛ෇͚ͨfindίϚϯυ) $find .git/objects -type f
 ←hello ←hello! ←ίϛοτͨ͠Β
 ૿͑ͯΔ?!
  23. 23 ૿͑ͨ̎ͭͷϋογϡ஋͸ͳΜͩΖ͏ ίϛοτ͞ΕͨΦϒδΣΫτͷϋογϡͷϦετΛදࣔ͢ΔίϚϯυ $git rev-list --all --objects --format=oneline
 ←hello!ʹߋ৽ͨ͠ϋογϡ஋ ←ίϛοτͨ͠Β૿͑ͨϋογϡ஋

  24. 24 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 34e600; git cat-file -s

    34e600; git cat-file -p 34e600;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 34(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README treeΦϒδΣΫτ:34e600920700d3d2d96ff92e3c057a8d24b1f3ed
  25. 25 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 34e600; git cat-file -s

    34e600; git cat-file -p 34e600;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 34(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README ↑Hello!ɹʹมߋͨ͠ίϛοτͩ treeΦϒδΣΫτ:34e600920700d3d2d96ff92e3c057a8d24b1f3ed
  26. 26 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 34(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧ໊ 100644

    blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README ̋TreeΦϒδΣΫτ͸ίϛοτ࣌఺ͷΠϯσοΫε৘ใ͔Β࡞ΒΕΔ ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) ·ͱΊ (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello! ̋TreeΦϒδΣΫτ͸࠷ޙʹaddͨ͠ϋογϡ஋ʹؔ࿈෇͚ΒΕ͍ͯΔ ͜ͷσʔλ͔Βϋογϡ஋͕࡞ΒΕ͍ͯΔ treeΦϒδΣΫτ:34e600920700d3d2d96ff92e3c057a8d24b1f3ed blobΦϒδΣΫτ:4effa19f4f75f846c3229b9dbdbad14eff362f32
  27. 27 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(commitΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 57c0a; git cat-file -s

    57c0a; git cat-file -p 57c0a; (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 195(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE AUTHOR COMMITTER 34e600920700d3d2d96ff92e3c057a8d24b1f3ed Marina Nakagawa Marina Nakagawa commitΦϒδΣΫτ:57c0a4b5d3002202a7b55be6eb3523b992527d09
  28. 28 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(commitΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 57c0a; git cat-file -s

    57c0a; git cat-file -p 57c0a; (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 195(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE AUTHOR COMMITTER 34e600920700d3d2d96ff92e3c057a8d24b1f3ed Marina Nakagawa Marina Nakagawa ↑TreeΦϒδΣΫτͰ͖ͨϋογϡ஋ͩ commitΦϒδΣΫτ:57c0a4b5d3002202a7b55be6eb3523b992527d09 CommitΦϒδΣΫτ͸͍ͭ୭͕ԿͷͨΊʹίϛοτͨ͠ͷ͔͕Θ͔Δ
  29. 29 ίϛοτΛ͢ΔͱTreeΦϒδΣΫτͱcommitΦϒδΣΫτ͕࡞੒͞ΕΔ ίϛοτ͢ΔͱͲ͏ͳΔͷʁ (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 195(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE AUTHOR COMMITTER

    34e600920700d3d2d96ff92e3c057a8d24b1f3ed Marina Nakagawa Marina Nakagawa (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 34(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README commitΦϒδΣΫτ:57c0a4b5d3002202a7b55be6eb3523b992527d09 treeΦϒδΣΫτ:34e600920700d3d2d96ff92e3c057a8d24b1f3ed (ΦϒδΣΫτܕ+σʔλαΠζ) Blob 7 (ϑΝΠϧ಺༰)σʔλ Hello! blobΦϒδΣΫτ:4effa19f4f75f846c3229b9dbdbad14eff362f32
  30. 30 ΋͏Ұ౓Commitͯ͠ΈΑ͏

  31. 31 ผϑΝΠϧΛͭͬͯ͘ίϛοτ͢ΔͱͲ͏ͳΔͷʁ $mkdir test $cd test $echo 'Hello world' >

    sample.md $git add sample.md $git commit -m "2nd commit” testϑΥϧμΛ࡞ͬͯ Hello worldͱॻ͔Εͨsample.mdϑΝΠϧΛͭ͘Δ
  32. 32 ίϛοτ͞ΕͨΦϒδΣΫτͷϋογϡͷϦετΛදࣔ͢ΔίϚϯυ $git rev-list --all --objects --format=oneline
 ผϑΝΠϧΛͭͬͯ͘ίϛοτ͢ΔͱͲ͏ͳΔͷʁ ←TreeΦϒδΣΫτ ←commitΦϒδΣΫτ

  33. 33 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t e3da65; git cat-file -s

    e3da64; git cat-file -p e3da64;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 65(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README 40000 tree(ϑΥϧμͷҙ) 3b903ecdee168aad30b478201b8ff9d9b20c6119 test treeΦϒδΣΫτ:e3da64ffcb70336e1313bad123247c9691846bac ←TreeΦϒδΣΫτ
  34. 34 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t e3da65; git cat-file -s

    e3da64; git cat-file -p e3da64;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 65(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README 40000 tree(ϑΥϧμͷҙ) 3b903ecdee168aad30b478201b8ff9d9b20c6119 test treeΦϒδΣΫτ:e3da64ffcb70336e1313bad123247c9691846bac ←TreeΦϒδΣΫτ ͜ͷTreeΦϒδΣΫτͰ͸̎ͭͷSHA-1ϋογϡ஋Λอ͍࣋ͯ͠Δ
  35. 35 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t e3da65; git cat-file -s

    e3da64; git cat-file -p e3da64;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 65(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README 40000 tree(ϑΥϧμͷҙ) 3b903ecdee168aad30b478201b8ff9d9b20c6119 test treeΦϒδΣΫτ:e3da64ffcb70336e1313bad123247c9691846bac ←TreeΦϒδΣΫτ ࣍͸͜ΕΛ͠Β΂ͯΈ·͢
  36. 36 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 65(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊

    100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README 40000 tree(ϑΥϧμͷҙ) 3b903ecdee168aad30b478201b8ff9d9b20c6119 test treeΦϒδΣΫτ:e3da64ffcb70336e1313bad123247c9691846bac தΛղಡͯ͠ΈΑ͏ $git cat-file -t 3b903; git cat-file -s 3b903; git cat-file -p 3b903;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 37(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 802992c4220de19a90767f3000a79a31b98d0df7 sample.md treeΦϒδΣΫτ:3b903ecdee168aad30b478201b8ff9d9b20c6119
  37. 37 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(treeΦϒδΣΫτ) (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 65(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊

    100644 blob(ϑΝΠϧͷҙ) 4effa19f4f75f846c3229b9dbdbad14eff362f32 README 40000 tree(ϑΥϧμͷҙ) 3b903ecdee168aad30b478201b8ff9d9b20c6119 test treeΦϒδΣΫτ:e3da64ffcb70336e1313bad123247c9691846bac தΛղಡͯ͠ΈΑ͏ $git cat-file -t 3b903; git cat-file -s 3b903; git cat-file -p 3b903;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 37(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 802992c4220de19a90767f3000a79a31b98d0df7 sample.md treeΦϒδΣΫτ:3b903ecdee168aad30b478201b8ff9d9b20c6119 ࣍͸͜ΕΛ͠Β΂ͯΈ·͢
  38. 38 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(blobΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 80299; git cat-file -s

    80299; git cat-file -p 80299;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 12(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ Hello world blobΦϒδΣΫτ:802992c4220de19a90767f3000a79a31b98d0df7 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 37(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 802992c4220de19a90767f3000a79a31b98d0df7 sample.md treeΦϒδΣΫτ:3b903ecdee168aad30b478201b8ff9d9b20c6119
  39. 39 ૿͑ͨϋογϡ஋ͷ಺ͷ̍ͭΛݟΔ(blobΦϒδΣΫτ) தΛղಡͯ͠ΈΑ͏ $git cat-file -t 80299; git cat-file -s

    80299; git cat-file -p 80299;
 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 12(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ Hello world blobΦϒδΣΫτ:802992c4220de19a90767f3000a79a31b98d0df7 (ΦϒδΣΫτܕ+σʔλαΠζ) treeΦϒδΣΫτ 37(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ ϑΝΠϧܕ ΦϒδΣΫτܕ SHA-1ϋογϡ஋ ϑΝΠϧɾϑΥϧμ໊ 100644 blob(ϑΝΠϧͷҙ) 802992c4220de19a90767f3000a79a31b98d0df7 sample.md treeΦϒδΣΫτ:3b903ecdee168aad30b478201b8ff9d9b20c6119 ಺༰Λมߋͨ͠σʔλ͕Ͱ͖ͯͨ
  40. 40 treeΦϒδΣΫτͱblobΦϒδΣΫτͷؔ܎ੑΛ·ͱΊΔͱ blobΦϒδΣΫτ:4effa19f4f75f846c3229b9dbdbad14eff362f32 1st commit

  41. 41 treeΦϒδΣΫτͱblobΦϒδΣΫτͷؔ܎ੑΛ·ͱΊΔͱ blobΦϒδΣΫτ:4effa19f4f75f846c3229b9dbdbad14eff362f32 Hello!ͱ͍͏มߋͳͷͶʂ 1st commitͷঢ়ଶΛ෮ݩͰ͖Δ 1st commit

  42. 42 treeΦϒδΣΫτͱblobΦϒδΣΫτͷؔ܎ੑΛ·ͱΊΔͱ blobΦϒδΣΫτ:4effa19f4f75f846c3229b9dbdbad14eff362f32 2st commitͷঢ়ଶΛ෮ݩͰ͖Δ 2nd commit

  43. 43 TreeΦϒδΣΫτ͑͞Θ͔Ε͹ ຤୺ͷϑΝΠϧ·ͰͨͲΓண͚Δ

  44. 44 Tree͸Θ͔͚ͬͨͲ Commit͸Կͷҙຯ͕͋Δͷʁ

  45. 45 ίϛοτ͞ΕͨΦϒδΣΫτͷϋογϡͷϦετΛදࣔ͢ΔίϚϯυ $git rev-list --all --objects --format=oneline
 ←commitΦϒδΣΫτ ೋͭ໨ͷίϛοτΦϒδΣΫτΛݟͯΈΑ͏ தΛղಡͯ͠ΈΑ͏

    $git cat-file -t e3da65; git cat-file -s e3da64; git cat-file -p e3da64;

  46. 46 ೋͭ໨ͷίϛοτΦϒδΣΫτΛݟͯΈΑ͏ தΛղಡͯ͠ΈΑ͏ $git cat-file -t cff23; git cat-file -s

    cff23; git cat-file -p cff23; (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 243(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE PARENT AUTHOR COMMITTER e3da64ffcb70336e1313bad123247c9691846bac 57c0a4b5d3002202a7b55be6eb3523b992527d09 Marina Nakagawa Marina Nakagawa commitΦϒδΣΫτ:cff23168b95204aa210c34f95394cafc00db847b
  47. 47 ೋͭ໨ͷίϛοτΦϒδΣΫτΛݟͯΈΑ͏ தΛղಡͯ͠ΈΑ͏ $git cat-file -t cff23; git cat-file -s

    cff23; git cat-file -p cff23; (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 243(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE PARENT AUTHOR COMMITTER e3da64ffcb70336e1313bad123247c9691846bac 57c0a4b5d3002202a7b55be6eb3523b992527d09 Marina Nakagawa Marina Nakagawa commitΦϒδΣΫτ:cff23168b95204aa210c34f95394cafc00db847b ←͋ΕʁParent͕͍Δ
  48. 48 ೋͭ໨ͷίϛοτΦϒδΣΫτΛݟͯΈΑ͏ தΛղಡͯ͠ΈΑ͏ $git cat-file -t cff23; git cat-file -s

    cff23; git cat-file -p cff23; (ΦϒδΣΫτܕ+σʔλαΠζ) commit(ΦϒδΣΫτ) 243(σʔλαΠζ) (ϑΝΠϧ಺༰)σʔλ TREE PARENT AUTHOR COMMITTER e3da64ffcb70336e1313bad123247c9691846bac 57c0a4b5d3002202a7b55be6eb3523b992527d09 Marina Nakagawa Marina Nakagawa commitΦϒδΣΫτ:cff23168b95204aa210c34f95394cafc00db847b ←̍ͭલͷίϛοτΛࣔ͢
  49. 49 CommitΦϒδΣΫτͱTreeΦϒδΣΫτΛ·ͱΊΔͱ 2nd commit 1st commit ࠷৽ͷίϛοτ͑͞Θ͔Ε͹࠷ॳͷίϛοτ·Ͱશͯͷྺ࢙Λ௥͑Δ

  50. 50 CommitΦϒδΣΫτͱTreeΦϒδΣΫτΛ·ͱΊΔͱ 2nd commit 1st commit ͦΕͧΕͷίϛοτ͸TreeΦϒδΣΫτͷ৘ใΛ͍࣋ͬͯΔͨΊ ຤୺ͷϑΝΠϧ·ͰͨͲΓண͚Δ

  51. 51 Commitͱ͸ ̋̍ͭલͷίϛοτͱϓϩδΣΫτϧʔτͷtreeΦϒδΣΫτΛ஌ͬͯΔ ̋authorɾcommitterɾίϛοτϝοηʔδͷ৘ใ͕෇Ճ͞Εͨ΋ͷ

  52. 52 Gitͷཪଆࢀߟࢿྉ ΄΅͜ΕΛৄࡉʹௐ΂ͨ΋ͷͰ͢