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

Dive into .git 日本語版

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Dive into .git 日本語版

社内勉強会で使った資料の日本語版です

Avatar for NISHIO Hirokazu

NISHIO Hirokazu

May 24, 2012

More Decks by NISHIO Hirokazu

Other Decks in Programming

Transcript

  1. $ mkdir test $ cd test $ ls -a .

    .. $ git init Initialized empty Git repository in .../test/.git/ HJUJOJUUFTUͰ΋0, छ΋࢓ֻ͚΋ͳ͍ͨͩͷ ۭͷσΟϨΫτϦΛ࡞Δ ࣮ݧ༻ͷϦϙδτϦΛ࡞Δ ˡͰ͖ͨʂ
  2. த਎ΛݟͯΈΑ͏ $ cd .git $ tree . |-- HEAD |--

    config |-- description |-- hooks |-- info | `-- exclude |-- objects | |-- info | `-- pack `-- refs |-- heads `-- tags IPPLTͷத਎͸লུͨ͠
  3. $ cd .. $ touch README $ git add README

    $ git commit -m “initial commit” [master (root-commit) 4dd66d3] initial commit ίϛοτͨ͠Β Կ͕มΘΔʁ
  4. PCKFDUT͕૿͑ͨ $ tree .git/objects .git/objects |-- 4d | `-- d66d3a32a66f3578317717ccfb18

    |-- 54 | `-- 3b9bebdc6bd5c4b22136034a95dd |-- e6 | `-- 9de29bb2d1d6434b8b29ae775ad8 |-- info `-- pack ௕͍ϑΝΠϧ໊ͷ຤ඌ͸লུͨ͠ ଞʹ΋มΘΔ෦෼͕͋Δ͕ࠓճ͸ׂѪ
  5. $ cat > show.py #!/usr/bin/env python import sys import zlib

    data = file(sys.argv[1], "rb").read() data = zlib.decompress(data) print repr(data) தΛݟͯΈΑ͏ʂ දࣔεΫϦϓτΛ࡞Δ ҎԼͰ͸TIPXQZɻDINPE YΛ๨Εͣʹ
  6. $PNNJUͷத਎ $ ./show.py .git/objects/4d/d6... 'commit 201\x00 tree 543b...\n author NISHIO

    Hirokazu <...> 1337655529 +0900\n committer NISHIO Hirokazu <...> 1337655529 +0900\n \n initial commit\n' ద౰ʹվߦΛೖΕͨ USFFCʹ஫໨ ϋογϡ஋͸ίϛοτ࣌ͷϝοηʔδʹදࣔ͞Ε͍ͯΔ
  7. தΛݟͯΈΑ͏ $ git show --format=raw 4dd6 commit 4dd66d3a32a66f3578317717ccfb1876d43034ea tree 543b9bebdc6bd5c4b22136034a95dd097a57d3dd

    author NISHIO Hirokazu <...> 1337138246 +0900 committer NISHIO Hirokazu <...> 1337138246 +0900 initial commit diff --git a/README b/README new file mode 100644 index 0000000..e69de29 ϝʔϧΞυϨε͸লུͨ͠