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

「Gitによるバージョン管理」の執筆者によるGit勉強会か講演会 / git bundle

「Gitによるバージョン管理」の執筆者によるGit勉強会か講演会 / git bundle

「Gitによるバージョン管理」の執筆者によるGit勉強会か講演会 / git bundle についてのスライドです。

Nobuhiro Iwamatsu

February 29, 2012
Tweet

More Decks by Nobuhiro Iwamatsu

Other Decks in Programming

Transcript

  1. . . . . . . ϦϙδτϦ΁ͷΞΫηε • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷
  2. . . . . . . ϦϙδτϦ΁ͷΞΫηε • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷ • gitɺWebDAVɺfileɺrsyncɺsshɺmailɺetcɻ
  3. . . . . . . GitΛ࢖ͬͨ։ൃ A:ʮϦϙδτϦͷߋ৽͍ͨ͠ͷͰύον௖ଷɻ ʯ B:ʮαʔόʹϦϙδτϦஔ͍ͱ͍͔ͨΒ͔ͦ͜Β

    pull Ͱ͖ΔΑɻ ʯ A:ʮ͋ʔɺ͔͜͜Βͦ͜ͷωοτϫʔΫʹܨ͛Β Εͳ͍ΜͩΑͶɻ ʯ
  4. . . . . . . GitΛ࢖ͬͨ։ൃ A:ʮϦϙδτϦͷߋ৽͍ͨ͠ͷͰύον௖ଷɻ ʯ B:ʮαʔόʹϦϙδτϦஔ͍ͱ͍͔ͨΒ͔ͦ͜Β

    pull Ͱ͖ΔΑɻ ʯ A:ʮ͋ʔɺ͔͜͜Βͦ͜ͷωοτϫʔΫʹܨ͛Β Εͳ͍ΜͩΑͶɻ ʯ Bʮ͸͊ʁ(AA ུʯ
  5. . . . . . . LAN΍Πϯλʔωοτܦ༝ͰϦϙδτ ϦΛߋ৽Ͱ͖ͳ͍ • ࣾ಺/άϧʔϓձࣾͰͷ͕͠ΒΈ

    • ։ൃִ཭෦԰ • ϋʔυ΢ΣΞͷ੍ݶʢRS232C ͔͠ແ͍ͱ͔ʣ
  6. . . . . . . LAN΍Πϯλʔωοτܦ༝ͰϦϙδτ ϦΛߋ৽Ͱ͖ͳ͍ • ࣾ಺/άϧʔϓձࣾͰͷ͕͠ΒΈ

    • ։ൃִ཭෦԰ • ϋʔυ΢ΣΞͷ੍ݶʢRS232C ͔͠ແ͍ͱ͔ʣ • ਅ໘໨ͳ࿩ɺωοτϫʔΫ࢖͏ΑΓૣ͍৔߹ɻ
  7. . . . . . . LAN΍Πϯλʔωοτܦ༝ͰϦϙδτ ϦΛߋ৽Ͱ͖ͳ͍ • ࣾ಺/άϧʔϓձࣾͰͷ͕͠ΒΈ

    • ։ൃִ཭෦԰ • ϋʔυ΢ΣΞͷ੍ݶʢRS232C ͔͠ແ͍ͱ͔ʣ • ਅ໘໨ͳ࿩ɺωοτϫʔΫ࢖͏ΑΓૣ͍৔߹ɻ • ͦ͜ͰεχʔΧʔωοτϫʔΫΛ࢖͏ɻ
  8. . . . . . . εχʔΧʔωοτϫʔΫ ෳ਺୆ͷίϯϐϡʔλ͕͋ͬͯ΋ɺ௨৴ωοτ ϫʔΫ͕ಋೖ͞Ε͍ͯͳ͍ঢ়ଶΛεχʔΧʔωο τͱ͍͏ɻ͜ͷݴ༿͸͋Δίϯϐϡʔλ͔Βผͷ

    ίϯϐϡʔλʹσʔλΛૹΔඞཁ͕Ͱ͖ͨͱ͖ʹ ϑϩοϐʔσΟεΫ΍ MO ͳͲΛ࣋ͬͨਓ͕ؒ૸ Γճ͍ͬͯΔঢ়ଶΛൽ೑ͬͯʮεχʔΧʔΛཤ͍ ͨਓؒΛഔհʹͨ͠ωοτϫʔΫʯͱ͍͏ҙຯͰ ͚ͭΒΕͨɻ1 1Wikipedia:εχʔΧʔωοτϫʔΫ͔Βൈਮ
  9. . . . . . . ϦϙδτϦ΁ͷΞΫηε • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷
  10. . . . . . . ϦϙδτϦ΁ͷΞΫηε • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷ • gitɺWebDAVɺfileɺrsyncɺsshɺmailɺetcɻ
  11. . . . . . . ϦϙδτϦ΁ͷΞΫηε • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷ • gitɺWebDAVɺfileɺrsyncɺsshɺmailɺetcɻ • ΋ͪΖΜεχʔΧʔωοτϫʔΫ΋ͩͬʂ
  12. . . . . . . git bundle • bundle

    : ଋɺଋঢ়ߏ଄ • ओͳػೳ: ίϛοτΛଋʹవΊͯɺϑΝΠϧ ʹग़ྗ͢Δ
  13. . . . . . . bundle Πϝʔδ࡞੒ git bundle

    create $ git bundle create ../update.bundle v1.0..v2.0 Counting objects: 20, done. Delta compression using up to 4 threads. Compressing objects: 100% (13/13), done. Writing objects: 100% (19/19), 1.24 KiB, done. Total 19 (delta 10), reused 0 (delta 0)
  14. . . . . . . bundle Πϝʔδݕূ $ git

    bundle verify ../update.bundle The bundle contains 1 ref 187a8a3a13118a52d799998219e9c8f25e1bf9a3 refs/tags/v2.0 The bundle requires these 1 ref 13f2c31dddc39cb0ae6814cc83ce91f240914446 Add data1 ../update.bundle is okay
  15. . . . . . . ݕূΤϥʔʹͳΔύλʔϯ ΤϥʔʹͳΔɻ $ git

    bundle verify ../update.bundle error: Repository lacks these prerequisite commits: error: 902bbbc4f0bfc2cec2335123cc590fa600a239c3 Add data1
  16. . . . . . . bundle ΠϝʔδͷऔΓࠐΈ • git

    pull git pull ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git fetch git fetch ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git remote git remote update ϦϞʔτϦϙδτϦ໊
  17. . . . . . . bundle ΠϝʔδͷऔΓࠐΈ • git

    pull git pull ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git fetch git fetch ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git remote git remote update ϦϞʔτϦϙδτϦ໊ • ϦϑΝϨϯεΛࢦఆ͢Δඞཁ͕͋Δ
  18. . . . . . . bundle ΠϝʔδͷऔΓࠐΈ • git

    pull git pull ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git fetch git fetch ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git remote git remote update ϦϞʔτϦϙδτϦ໊ • ϦϑΝϨϯεΛࢦఆ͢Δඞཁ͕͋Δ
  19. . . . . . . bundle Πϝʔδ಺ʹ͋ΔϦϑΝϨϯε Λग़ྗ $

    git bundle list-heads ../update.bundle 187a8a3a13118a52d799998219e9c8f25e1bf9a3 refs/tags/v2.0 ../update.bundle ʹ͸ϦϑΝϨϯεͱͯ͠ refs/tags/v2.0 ͷΈؚ͕·Ε͍ͯΔ͜ͱ͕Θ ͔Δɻ
  20. . . . . . . bundle ΠϝʔδͷऔΓࠐΈ • git

    pull git pull ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git fetch git fetch ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git remote git remote update ϦϞʔτϦϙδτϦ໊ • ϦϑΝϨϯεΛࢦఆ͢Δඞཁ͕͋Δ
  21. . . . . . . bundle ΠϝʔδͷऔΓࠐΈ • git

    pull git pull ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git fetch git fetch ϦϞʔτϦϙδτϦ ϦϑΝϨϯε • git remote git remote update ϦϞʔτϦϙδτϦ໊ • ϦϑΝϨϯεΛࢦఆ͢Δඞཁ͕͋Δ • bundle ϑΝΠϧ͸ϦϞʔτϦϙδτϦͱͯ͠ ѻ͑Δ
  22. . . . . . . git pull ϦϑΝϨϯεΛࢦఆ͠ͳ͍৔߹: $

    git pull ../update.bundle fatal: Couldn’t find remote ref HEAD HEAD ͕ bunlde ϑΝΠϧʹؚ·Εͯͳ͍ͷͰΤ ϥʔʹͳΔɻ
  23. . . . . . . git pull ϦϑΝϨϯεΛࢦఆͨ͠৔߹: $

    git pull ../update.bundle refs/tags/v2.0 Receiving objects: 100% (19/19), done. Resolving deltas: 100% (10/10), done. From ../update.bundle * tag v2.0 -> FETCH_HEAD Updating c74b792..fea9e6f Fast-forward data3 | 1 + data4 | 1 + data5 | 1 + dataA | 1 + dataB | 1 + dataC | 1 + 6 files changed, 6 insertions(+), 0 deletions(-) create mode 100644 data3 ʢলུʣ
  24. . . . . . . git pull • git

    pull → Ϛʔδ͕ى͖ΔՄೳੑɻ • ϦϞʔτϦϙδτϦͱͯ͠औΓѻ͏ͷ͕ΊΜ Ͳ͏͍͘͞ɻ FETCH HEAD Λ࢖ͬͯ࡞ۀ͢Δඞཁ͕͋Δɻ • HEAD ͕ͳ͍৔߹ɺϦϑΝϨϯεΛࢦఆ͢Δ ඞཁ͕͋Δɻ
  25. . . . . . . git fetch $ git

    fetch ../update.bundle fatal: Couldn’t find remote ref HEAD $ git fetch ../update.bundle refs/tags/v2.0 Receiving objects: 100% (19/19), done. Resolving deltas: 100% (10/10), done. From ../update.bundle * tag v2.0 -> FETCH_HEAD
  26. . . . . . . git fetch • git

    fetch → Ϛʔδ͸ى͖ͳ͍ɻ • HEAD ͕ͳ͍৔߹ɺϦϑΝϨϯεΛࢦఆ͢Δ ඞཁ͕͋Δɻ
  27. . . . . . . git remote $ git

    remote add bundle-data ../update.bundle $ git remote update bundle-data Fetching bundle-data From ../bundle-20120228 * [new tag] v2.0 -> v2.0
  28. . . . . . . git remote • git

    remote → Ϛʔδ͸ى͖ͳ͍ • ϦϑΝϨϯεΛࢦఆ͢Δඞཁ͕ͳ ͍ɻ.git/config ͷ refspec ݟͯ͘ΕΔ • remote ʹઃఆ͓͚ͯ͠͹࣍ճ͔Β͸ϑΝΠϧ ίϐʔͯ͠ɺgit remote update Ͱ OK • git remote ࢖͍·͠ΐ͏
  29. . . . . . . git bundle unbundle Git

    ΦϒδΣΫτΛ git index-pack Λ࢖ͬͯ .git/objects ҎԼʹల։͢Δɻ $ git bundle unbundle ../update.bundle Git ΦϒδΣΫτਥޚ༻ୡπʔϧɻ fetch ͳͲ͸ඞཁͳ΋ͷ͚ͩΛरͬͯల։͢Δɻ
  30. . . . . . . λά΍ϒϥϯν͸Ͳ͏͢Δͷʁ • bundle ࡞੒࣌ʹऔΓࠐΈ͍ͨλά΍ϒϥϯν

    Λࢦఆ͢Δ • શͯͷλά͸ --tags Λࢦఆ͢Δ • શͯͷϒϥϯν͸--branch Λࢦఆ͢Δ • શͯͷϦϑΝϨϯεΛऔΓࠐΈ͍ͨ৔߹ʹ͸ --all Λࢦఆ͢Δ
  31. . . . . . . λά΍ϒϥϯν͸Ͳ͏͢Δͷʁ $ git bundle

    create ../update.bundle v1.0..v2.0 \ --tags --branches
  32. . . . . . . ࣅͨΑ͏ͳػೳ git format-patch ͸Ͳ͏

    ͳͷʁ • git format-patch : ύονΛ git send-email Ͱ ૹ৴Ͱ͖ΔܗࣜͰग़ྗ͢Δɻ
  33. . . . . . . ࣅͨΑ͏ͳػೳ git format-patch ͸Ͳ͏

    ͳͷʁ • git format-patch : ύονΛ git send-email Ͱ ૹ৴Ͱ͖ΔܗࣜͰग़ྗ͢Δɻ ໰୊: • େྔͷύονͰॲཧͱ؅ཧ͕ΊΜͲ͏͘ ͍͞ɻ • ώϡʔϚϯΤϥʔͰଞͷϦϙδτϦͱͷ੔߹ ੑ͕औΕͳ͘ͳΔՄೳੑ͕͋Δɻ • ϒϥϯνɺλάͳͲΛऔΓѻ͏͜ͱ͕Ͱ͖ ͳ͍ɻ
  34. . . . . . . ϦϙδτϦͷόοΫΞοϓ Git ͷ git

    ϦϙδτϦΛ όοΫΞοϓͯ͠Έͨɻ ॲཧ/ѹॖํࣜ ॲཧ଎౓ αΠζ tar/gz 2.207s 37MB tar/xz 22.477s 36MB git bundle 3.531s 27MB
  35. . . . . . . ϦϙδτϦͷόοΫΞοϓ Git ͷ git

    ϦϙδτϦΛ όοΫΞοϓͯ͠Έͨɻ ॲཧ/ѹॖํࣜ ॲཧ଎౓ αΠζ tar/gz 2.207s 37MB tar/xz 22.477s 36MB git bundle 3.531s 27MB git bundle େউརʂ
  36. . . . . . . ·ͱΊ • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷
  37. . . . . . . ·ͱΊ • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷ • εχʔΧωοτϫʔΫ΋ରԠ
  38. . . . . . . ·ͱΊ • Git ͸෼ࢄϦϙδτϦܕ

    • Git ͸ϦϙδτϦ΁ͷΞΫηεํ๏͕ଟ༷ • εχʔΧωοτϫʔΫ΋ରԠ • git bundle ॏཁ • ϦϙδτϦόοΫΞοϓʹ͸ git bundle