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

    TFNBOUJDTJOGPTFDOFUXPSLʹڵຯ͕͋Γ·͢ w དྷ݄஀ੜ೔  ͰͳͷͰਓੜͷઌഐํ֤Ґʹ͓͖·͠ ͯ͸ඒຯ͍͓͠ञͷҿΈ͔ͨΛืूͯ͠·͢
  2. (JU0CKFDU w HJUJOJUΛͯ͠IPHF͢Δͱੜ·ΕΔHJUPCKFDUTͷதͷ࿩ w CMPC w ϑΝΠϧσʔλΛදݱͯ͠Δ w 5SFF w

    ϑΥϧμߏ଄Λදݱͯ͠Δ w $PNNJU w USFF΁ͷࢀরͱίϛοτϢʔβʔͱλΠϜελοϓͷදݱ
  3. 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
  4. 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
  5. 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
  6. w DPNNJUUSFFʹύΠϓͯ͠pSTUDPNNJU w $PNNJUΛ࡞ΔίϚϯυ w HJUDBUpMFͰνΣοΫɽ͔֬ʹग़དྷͯΔ $ echo 'first commit'

    | git commit-tree c47b > 9ee76e488f2882f12e5fb15d8016e80946ff48dd $ git cat-file -p 9ee76e488f2882f12e5fb15d8016e80946ff48dd > tree c47b19c8b7a3b7724138f73e4cd53efa0f1e9595 > author TakeruHayasaka <[email protected]> 1538081510 +0900 > committer TakeruHayasaka <[email protected]> 1538081510 +0900 > first commit