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

ファイルを作らずGitにCommit!

 ファイルを作らずGitにCommit!

タガヤスその7で話したLT資料です

Takeru Hayasaka

September 28, 2018
Tweet

More Decks by Takeru Hayasaka

Other Decks in Programming

Transcript

  1. ϑΝΠϧΛ࡞Βͣ(JU
    ʹ$PNNJU
    5BLFSV)BZBTBLB !UBLFNJP*0

    ʢλΨϠεͦͷ̓ʣ
    1

    View full-size slide

  2. ࣄલௐࠪ

    View full-size slide

  3. (JU࢖ͬͨ͜ͱ͋Δਓ
    ڍखʂ

    View full-size slide

  4. (JUͷϓϩڍखʂ

    View full-size slide

  5. ϓϩͷํ͸෼ͪΐͬͱͷ
    ٳܜʹͳΓ·͢ɾɾɾ

    View full-size slide

  6. ๻͸ϓϩ͡Όͳ͍ͷͰؒҧ
    ͑ͨΒ͝ΊΜͳ͍͞ʼʻ

    View full-size slide

  7. XIPBNJ
    w ͸΍͔͚ͨ͞Δ !UBLFNJP*0

    w ౦๺ֶӃେֶ޻ֶ෦೥
    w ΠϯϑΟχοτϧʔϓͰΞϧόΠτΛͯ͠Δ
    w TFNBOUJDTJOGPTFDOFUXPSLʹڵຯ͕͋Γ·͢
    w དྷ݄஀ੜ೔
    ͰͳͷͰਓੜͷઌഐํ֤Ґʹ͓͖·͠
    ͯ͸ඒຯ͍͓͠ञͷҿΈ͔ͨΛืूͯ͠·͢

    View full-size slide

  8. ΠϯϑΟχοτϧʔϓઋ୆Ͱ͸(JU͕
    ࢖͑ΔֶੜΞϧόΠτΛืूͯ͠·͢
    $.

    View full-size slide

  9. (JU$IBMMFOHF
    ͰҐʹͳͬͨ

    View full-size slide

  10. (JU$IBMMFOHFͱ͸ʁ
    w NJYJ͕ओ࠵ͯ͠Δ(JUʹؔ͢ΔίϯςετɽֶੜΦϯϦʔ
    w HJUϦϙδτϦʹઃ͚ͨ೉୊ΛνʔϜϫʔΫͰղܾ͍ͯ͠
    ͘ڝٕܕͷٕज़Πϕϯτ
    w ҰԠશࠃ͔ΒॻྨநબͰબ͹ΕͨਓͷΈ͕ࢀՃͰ͖ΔΠ
    ϕϯτɽ

    View full-size slide

  11. ڝٕ؀ڥ
    w ೉қ౓͕̍d·Ͱ͋ΓɼϖΞͰߦ͏νʔϜઓͩͬͨ
    w νʔϜ͸ͦͷ৔Ͱ૊·͞Εͨॳର໘ͷਓ
    w ͱΓ͋͑ͣ΢ΥʔϜΞοϓ͕ͯΒ೉қ౓ͷ໰୊͔Β
    ղ͍͍ͯͬͨɽ
    w ղ͍ͨΒHJUIVCʹQVTI
    w $*ϕʔεͰ໰୊ΛΦʔτδϟονͯ͠Δ

    View full-size slide

  12. ໰୊ྫʢงғؾʣ
    w ίϯϑϦΫτΛ௚ͨ͠Γ
    w ഁଛͨ͠ϑΝΠϧΛम෮ͨ͠ΓɾɾɾͳͲ
    w ৄ͘͠͸ެ։৘ใͰ͸ͳ͍ͷͰݴ͑ͳ͍ͷͰ͝ΊΜͳ
    ͍͞ʼʻ

    View full-size slide

  13. େձͷงғؾ
    w ϖΞͰղ͍ͯΔͷͰNBTUFSʹQVTIGΛ͕ͪ͠

    View full-size slide

  14. େձͷงғؾ
    w ͓ޓ͍໰୊ղ͖ऴΘͬͨͱࢥͬͯΔ

    View full-size slide

  15. ޙ೔ஊ
    wޙ೔͋ΔϦϙδτϦͰʮ13ͷαΠζσΧΠʯͱ
    ΩϨΒΕͨ
    wීஈ࢖Θͳ͍೴Έͦ࢖ͬͨͷͰઋ୆Ӻ৐Γա͝͠
    ͯ੝ԬͰҰധͯ࢝͠ൃͰେֶʹΤΫετϦʔϜొ
    ߍΛ͢Δ͜ͱʹͳͬͨ

    View full-size slide

  16. ϑΝΠϧΛ࡞Βͣ(JUʹ
    $PNNJU

    View full-size slide

  17. Ͱ͖ΔΜͰ͢✊

    View full-size slide

  18. (JU0CKFDU
    w HJUJOJUΛͯ͠IPHF͢Δͱੜ·ΕΔHJUPCKFDUTͷதͷ࿩
    w CMPC
    w ϑΝΠϧσʔλΛදݱͯ͠Δ
    w 5SFF
    w ϑΥϧμߏ଄Λදݱͯ͠Δ
    w $PNNJU
    w USFF΁ͷࢀরͱίϛοτϢʔβʔͱλΠϜελοϓͷදݱ

    View full-size slide

  19. $PNNJUͷ࡞ΒΕํ
    wίϛοτͱ͍͏ͷ͸zCMPCzͱ͍͏σʔλ͕zUSFFz
    ʹඥ͍ͮͯΔ
    w$PNNJUPCKFDU͕USFFಉ࢜ͷίωΫγϣϯΛҙຯ
    ͯ͠Δ

    View full-size slide

  20. CMPCͱUSFFͷؔ܎ਤ

    View full-size slide

  21. $PNNJUͱUSFFͷؔ܎ਤ

    View full-size slide

  22. ࣮ࡍʹ΍ͬͯݟͨ

    View full-size slide

  23. w ϑΝΠϧΛ࡞Δ
    w HJUJOJU͢Δ
    w 0CKFDUͷத͸QBDL JOGPͷΈ͕ݱஈ֊ʹ͸ଘࡏͯ͠Δ
    $mkdir fugafuga
    $cd fugafuga/
    $git init
    > Initialized empty Git repository in fugafuga/.git/
    find .git/objects/
    > .git/objects/
    > .git/objects//pack
    > .git/objects//info

    View full-size slide

  24. w HJUIBTIPCKFDUʹύΠϓͯ͠DSFBUFEBUB
    w PCKFDU*%Λܭࢉͯ͠ϑΝΠϧ͔ΒCMPCΛ࡞੒͢ΔίϚϯυ
    w HJUDBUpMFͰνΣοΫɽ͔֬ʹग़དྷͯΔ
    $ echo 'create data' | git hash-object -w --stdin
    > 070f3bd01632c945394b3aac7187a9d91ca4816a
    $ ls
    $ git cat-file -p 070f
    > create data

    View full-size slide

  25. w HJUVQEBUFJOEFY
    w XPSLJOHUSFFͷϑΝΠϧΛJOEFYʹొ࿥͢Δ
    w ͸DINPEͱಉ͡ײ͡
    w UFTUUYUͱ͍͏ՍۭͷσʔλΛೖΕͯΔʢଘࡏͯ͠ͳ͍ʣ
    git update-index --add --cacheinfo 100644
    070f3bd01632c945394b3aac7187a9d91ca4816a test.txt

    View full-size slide

  26. w HJUXSJUFUSFFΛ࢖͏
    w 4UBHFJOHΤϦΞΛUSFFPCKFDUʹॻ͖ग़͢͜ͱ͕Ͱ͖Δ
    w ·ͩUSFF͕ͳ͍ͱ͖ʹࣗಈͰJOEFY͔ΒUSFFPCKFDUΛ࡞Δ
    w HJUDBUpMFͰνΣοΫɽ͔֬ʹग़དྷͯΔ
    $ git write-tree
    > c47b19c8b7a3b7724138f73e4cd53efa0f1e9595
    $ git cat-file -p c47b
    > 100644 blob
    070f3bd01632c945394b3aac7187a9d91ca4816a test.txt

    View full-size slide

  27. w DPNNJUUSFFʹύΠϓͯ͠pSTUDPNNJU
    w $PNNJUΛ࡞ΔίϚϯυ
    w HJUDBUpMFͰνΣοΫɽ͔֬ʹग़དྷͯΔ
    $ echo 'first commit' | git commit-tree c47b
    > 9ee76e488f2882f12e5fb15d8016e80946ff48dd
    $ git cat-file -p
    9ee76e488f2882f12e5fb15d8016e80946ff48dd
    > tree c47b19c8b7a3b7724138f73e4cd53efa0f1e9595
    > author TakeruHayasaka 1538081510
    +0900
    > committer TakeruHayasaka
    1538081510 +0900
    > first commit

    View full-size slide

  28. ·ͱΊ
    w ίϛοτͱ͍͏ͷ͸zCMPCzͱ͍͏σʔλ͕zUSFFzʹඥ͍ͮͯΔ
    w $PNNJUPCKFDU͕USFFಉ࢜ͷίωΫγϣϯΛҙຯͯ͠Δ
    w (JUͱ͍͏ͷ͸࣮͸௿ϨΠϠʔͳදݱΛந৅Խͯͯ͠ීஈ๻Β
    ͸࢖͍ͬͯΔɽ

    View full-size slide

  29. w IUUQTHJUTDNDPNCPPLKBW
    (JU&"&&&#
    (JU&""&&#&"
    &"'&
    w IUUQUBLFJPIBUFOBCMPHDPNFOUSZ

    ϦϑΝϨϯε

    View full-size slide