commitã£ã¦çµå±ãªããªã®?ã¨ããã¯ãªãã§ãï¼commitã®ä¸èº«ã表示ãã¦ãã¼ã¿ã®å®ä½ãè¦ã¦ã¿ã¾ãï¼
ãããã¦èªã¿ãã: Git for Computer Scientists
é©å½ãªcommitã®object id ( = SHA1 )ãå¾ãããã«git show-refã§masterãã©ã³ãã®HEAD commitã®object idãå¾ã¾ãï¼
$ git show-ref refs/heads/master # master ã® HEAD ã® commit ã® obeject id ã表示
216640790e88d6fd794a96fd1a7c81dd2ad86981 refs/heads/master
以ä¸ã®ããã«ãã¦ï¼git cat-file ã§commitã®å 容ã表示ã§ãã¾ãï¼treeã«ã¯commitãçºçããæç¹ã§ã®ãã¡ã¤ã«ããªã¼ãåç¾ããããã®æ å ±ãå ¥ã£ã¦ãã¾ãï¼parentã¯ãã®commitã®è¦ªã«ãããcommitã§ãï¼
$ git cat-file commit 216640790e88d6fd794a96fd1a7c81dd2ad86981 # commit ã®ä¸èº«ã表示 tree adb285a47d87f238c7ae64cac70222821084b8dd # commit ã«å¯¾å¿ãã tree ã® object id parent 3e8ba4bffdc7b36b85f99538558623faabcdaf24 # 親 commit ã® object id author hakobe932 <[email protected]> 1234567890 +0900 # ä½è ? committer hakobe932 <[email protected]> 1234567890 +0900 # ã³ããã¿ ahe ãã³ããããããï¼ # ã³ããããã°
ããã«ï¼git ls-tree 㧠tree ã®ä¸èº«ã表示ã§ãã¾ãï¼blobã¯æ®éã®ãã¡ã¤ã«ã§ãï¼treeã¯ãã£ã¬ã¯ããªã§ãï¼ãããã対å¿ãã object id ã§å®ä½ãåå¾ã§ãã¾ãï¼treeã®ä¸èº«ãã¿ãã«ã¯åæ§ã«git ls-treeã使ãã¾ãï¼blobã®ä¸èº«ãã¿ãã«ã¯git cat-fileã使ãã¾ãï¼
$ git ls-tree adb285a47d87f238c7ae64cac70222821084b8dd # tree ã®ãªãã¿ã表示 100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 ahe 100644 blob 65a228ae78d3c7abae20edcfb141d2443bedb893 puu 040000 tree 06d399b211ed3468cd32b294795f8bc8ae83b0e4 bin $ git cat-file blob 65a228ae78d3c7abae20edcfb141d2443bedb893 # blob ã®ãªãã¿ã表示 (masterã®HEADã§ã® cat puu ã¨ç価) puu aheahe heheheh-! howhow
ãã®ããã«?ï¼commit ããããã° commit ã«å¯¾å¿ãã tree ãå¾ããã¾ãï¼treeã«ã¯ãã®commitãè¡ããã段éã§ã®ãã¡ã¤ã«ããªã¼ã®æ å ±ãå ¥ã£ã¦ããã®ã§ï¼ãã¤ã§ããã®ãã¡ã¤ã«ããªã¼ãåç¾ã§ãã¾ãï¼commitã®parentããã©ãã°ããã¾ã§ã«ã©ã®ãããªå¤æ´ããªããã¦ãããããããã¾ãï¼
ãããã£ã¦ã¿ãã¨ï¼ã·ã³ãã«ã§ãããããããã¼ã¿æ§é ã«ãã£ã¦gitã®commitãè¨é²ããã¦ããã®ããããã¾ããï¼object idããã¡ãã¡é·ãã¦ã¿ããããã©ï¼
ã¡ãªã¿ã«
object 㯠.git/objectsã«è¨é²ããã¦ãã¾ãï¼ãã¨ãã°ï¼65a228ae78d3c7abae20edcfb141d2443bedb893 ã¨ãã object㯠.git/objects/65/a228ae78d3c7abae20edcfb141d2443bedb893 ã«è¨é²ããã¦ã¾ãï¼object idã®æåã®äºæ¡ããã£ã¬ã¯ããªåã«ãªã£ã¦ã¾ãï¼
object id 㯠ãã¡ã¤ã«ãããªã¼ãã³ããããä¸æã«ç¹å®ããå¿ è¦ãããã®ã§ãã¶ã£ã¦ã¯ãããªãã®ã§ããï¼40æ¡ã®SHA1 hex ã 㨠1極4615è¼0163æ£7330æ¾9029è¬1820å£3684æ¼8327å1628京3019å 6559å3254ä¸2976 ã® id ã表ç¾ã§ããã®ã§ï¼ããã·ã¥é¢æ°ããã¾ãã¤ããã°ãããããã¶ããªãããã§ãï¼