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

内部構造から学ぶGit

A1
April 24, 2017

 内部構造から学ぶGit

社内勉強会資料

A1

April 24, 2017
Tweet

More Decks by A1

Other Decks in Programming

Transcript

  1. commit ff86faf2fa02bc21933c9e1dcc75c8d81b3e104a Merge: 8f8d0ec 552a736 Author: Taro <[email protected]> Date: Wed

    Aug 19 14:49:37 2015 -0700 Bugfix xxx commit 8f8d0ecfde871144ae839876039fe4e8fed75a9c Author: Taro <[email protected]> Date: Wed Aug 19 14:46:09 2015 -0700 Refactoring xxx commit 011710a315a5e4157e882880fe77798f8d4adde0 Merge: 8c9155e 09bb652 Author: Taro <[email protected]> Date: Wed Aug 19 14:48:56 2015 -0700 Merge branch 'todo' git logͷ݁Ռ
  2. commitΦϒδΣΫτ $ git cat-file -p ff86fa tree c95970c3507b89fe43181df983f73c8f1db262fb parent 8f8d0ecfde871144ae839876039fe4e8fed75a9c

    parent 552a736de775994570570a0514f24e32686afbe0 author Taro <[email protected]> 1440020977 -0700 committer Taro <[email protected]> 1440020977 -0700 Bugfix: xxx
  3. treeΦϒδΣΫτ $ git cat-file -p c95970 100644 blob 5e98806c6cc246acef5f539ae191710a0c06ad3f .gitattributes

    100644 blob a685ec1fb0ca49607431a65f1ccf035bb9b95a3a .gitignore 100644 blob ece2951a2b1e1cdd611c7dc371e50501d416d1f8 .mailmap 100644 blob 536e55524db72bd2acf175208aef4f3dfc148d42 COPYING 040000 tree dbb0cc4bf1e93167118aa39e57c8b7efa9113598 Documentation 100755 blob fc45283501a3b004edabc55781b486b37509dd37 GIT-VERSION-GEN ϑΝΠϧͱϑΥϧμͷ৘ใΛ อ͍࣋ͯ͠Δɻ
  4. blobΦϒδΣΫτ $ git cat-file -p 4223f1 package main import “fmt”

    fun main() { fmt.Printf(“Hello World”) } ಡΊΔʂಡΊΔͧʂʂ
  5. GitͷϑΥϧμߏ੒ .git !"" HEAD ←HEAD͕Ͳ͜Λࢦ͍ࣔͯ͠͠Δ !"" config ←จࣈ௨ΓઃఆϑΝΠϧ !"" description

    !"" hooks ←hookεΫϦϓτ !"" info # %"" exclude !"" objects ←͜͜ʹΦϒδΣΫτ͕ೖ͍ͬͯΔ # !"" 22 # # %"" 62de0c121f22df8e78f5a37d6e114fd322c0b0 # !"" 3e # # %"" 2799e0729c58acb86bb40f19c8cb4b2b4f8e96 # !"" 46 # # %"" d2987acc571a47f9e69b585eb833f6e903b2cc # !"" 6c # # %"" c84aae39643fdb94d1699b74b07e2c6500cbaf # !"" info # %"" pack %"" refs !"" heads %"" tags 8 directories, 13 files
  6. ಉ͡಺༰ͷϑΝΠϧΛ࡞੒ͯ͠ΈΔ $ echo "hoge" > a.txt $ echo "hoge" >

    b.txt $ git add . $ git commit -m 'add a.txt and b.txt' [master (root-commit) 6cc84aa] add a.txt and b.txt 2 files changed, 2 insertions(+) create mode 100644 a.txt create mode 100644 b.txt $ git cat-file -p 6cc84aa tree f5aecbff04f484dcf74e14fc6961da0a8b6d43ad author eichisanden <[email protected]> 1440425753 +0900 committer eichisanden <[email protected]> 1440425753 +0900 add a.txt and b.txt $ git cat-file -p f5aecbff 100644 blob 2262de0c121f22df8e78f5a37d6e114fd322c0b0 a.txt 100644 blob 2262de0c121f22df8e78f5a37d6e114fd322c0b0 b.txt $ git cat-file -p 2262 hoge ϋογϡ͸ಉ͡஋ͳͷͰແବͳΦ ϒδΣΫτ͸࡞ΒΕͳ͍ʂ
  7. ͨͩɺGCͰpackfileʹҠಈ͞Ε༰ྔ͸ݮΔͷͰେৎ෉ .git !"" HEAD ←HEAD͕Ͳ͜Λࢦ͍ࣔͯ͠͠Δ !"" config ←จࣈ௨ΓઃఆϑΝΠϧ !"" description

    !"" hooks ←hookεΫϦϓτ !"" info # %"" exclude !"" objects # !"" 22 # # %"" 62de0c121f22df8e78f5a37d6e114fd322c0b0 # !"" 3e # # %"" 2799e0729c58acb86bb40f19c8cb4b2b4f8e96 # !"" 46 # # %"" d2987acc571a47f9e69b585eb833f6e903b2cc # !"" 6c # # %"" c84aae39643fdb94d1699b74b07e2c6500cbaf # !"" info # %"" pack ←͜͜ʹҠಈ͞ΕΔ %"" refs !"" heads %"" tags 8 directories, 13 files