$30 off During Our Annual Pro Sale. View Details »

ファイルを作らず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

  2. ࣄલௐࠪ

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

  4. (JUͷϓϩڍखʂ

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

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

  7. XIPBNJ w ͸΍͔͚ͨ͞Δ !UBLFNJP*0  w ౦๺ֶӃେֶ޻ֶ෦೥ w ΠϯϑΟχοτϧʔϓͰΞϧόΠτΛͯ͠Δ w

    TFNBOUJDTJOGPTFDOFUXPSLʹڵຯ͕͋Γ·͢ w དྷ݄஀ੜ೔  ͰͳͷͰਓੜͷઌഐํ֤Ґʹ͓͖·͠ ͯ͸ඒຯ͍͓͠ञͷҿΈ͔ͨΛืूͯ͠·͢
  8. ΠϯϑΟχοτϧʔϓઋ୆Ͱ͸(JU͕ ࢖͑ΔֶੜΞϧόΠτΛืूͯ͠·͢ $.

  9. ۙگ

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

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

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

    w $*ϕʔεͰ໰୊ΛΦʔτδϟονͯ͠Δ
  13. ໰୊ྫʢงғؾʣ w ίϯϑϦΫτΛ௚ͨ͠Γ w ഁଛͨ͠ϑΝΠϧΛम෮ͨ͠ΓɾɾɾͳͲ w ৄ͘͠͸ެ։৘ใͰ͸ͳ͍ͷͰݴ͑ͳ͍ͷͰ͝ΊΜͳ ͍͞ʼʻ

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

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

  16. ݁Ռ

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

  18. ຊ୊

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

  20. Ͱ͖ΔΜͰ͢✊

  21. (JU0CKFDU w HJUJOJUΛͯ͠IPHF͢Δͱੜ·ΕΔHJUPCKFDUTͷதͷ࿩ w CMPC w ϑΝΠϧσʔλΛදݱͯ͠Δ w 5SFF w

    ϑΥϧμߏ଄Λදݱͯ͠Δ w $PNNJU w USFF΁ͷࢀরͱίϛοτϢʔβʔͱλΠϜελοϓͷදݱ
  22. $PNNJUͷ࡞ΒΕํ wίϛοτͱ͍͏ͷ͸zCMPCzͱ͍͏σʔλ͕zUSFFz ʹඥ͍ͮͯΔ w$PNNJUPCKFDU͕USFFಉ࢜ͷίωΫγϣϯΛҙຯ ͯ͠Δ

  23. None
  24. CMPCͱUSFFͷؔ܎ਤ

  25. $PNNJUͱUSFFͷؔ܎ਤ

  26. ࣮ࡍʹ΍ͬͯݟͨ

  27. 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
  28. 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
  29. w HJUVQEBUFJOEFY w XPSLJOHUSFFͷϑΝΠϧΛJOEFYʹొ࿥͢Δ w ͸DINPEͱಉ͡ײ͡ w UFTUUYUͱ͍͏ՍۭͷσʔλΛೖΕͯΔʢଘࡏͯ͠ͳ͍ʣ git update-index

    --add --cacheinfo 100644 070f3bd01632c945394b3aac7187a9d91ca4816a test.txt
  30. 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
  31. w DPNNJUUSFFʹύΠϓͯ͠pSTUDPNNJU w $PNNJUΛ࡞ΔίϚϯυ w HJUDBUpMFͰνΣοΫɽ͔֬ʹग़དྷͯΔ $ echo 'first commit'

    | git commit-tree c47b > 9ee76e488f2882f12e5fb15d8016e80946ff48dd $ git cat-file -p 9ee76e488f2882f12e5fb15d8016e80946ff48dd > tree c47b19c8b7a3b7724138f73e4cd53efa0f1e9595 > author TakeruHayasaka <taketarou2@gmail.com> 1538081510 +0900 > committer TakeruHayasaka <taketarou2@gmail.com> 1538081510 +0900 > first commit
  32. ·ͱΊ w ίϛοτͱ͍͏ͷ͸zCMPCzͱ͍͏σʔλ͕zUSFFzʹඥ͍ͮͯΔ w $PNNJUPCKFDU͕USFFಉ࢜ͷίωΫγϣϯΛҙຯͯ͠Δ w (JUͱ͍͏ͷ͸࣮͸௿ϨΠϠʔͳදݱΛந৅Խͯͯ͠ීஈ๻Β ͸࢖͍ͬͯΔɽ

  33. w IUUQTHJUTDNDPNCPPLKBW (JU&"&&&# (JU&""&&#&" &"'& w IUUQUBLFJPIBUFOBCMPHDPNFOUSZ  ϦϑΝϨϯε