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

なぜGitでバイナリファイルをおいてはいけないかGitの内部構造から考える

93c80c388fe9d8f9df7d030549a0ff0b?s=47 Takeshi Kondo
September 05, 2017

 なぜGitでバイナリファイルをおいてはいけないかGitの内部構造から考える

93c80c388fe9d8f9df7d030549a0ff0b?s=128

Takeshi Kondo

September 05, 2017
Tweet

More Decks by Takeshi Kondo

Other Decks in Technology

Transcript

  1. ͳͥGitͰόΠφϦϑΝΠ ϧΛ͓͍ͯ͸͍͚ͳ͍͔ Gitͷ಺෦ߏ଄͔Βߟ͑Δ 2017/08/31 kondo takeshi

  2. Git͓͡͞Μ

  3. ΅͘ʮ͜Εยํ͍Βͳ͘ͳ͍ʁ ফͦ͏Αʯ ͱ͋ΔHJUϦϙδτϦ @QBUDI @QBUDI  

  4. ޙഐ͘Μʮ͑ʔʁফ͢ΜͰ͢ ͔ʔʁԿ͔ා͍ͬ͢oldͰ͍͍ Ͱ͔͢ʔʁʯ

  5. ΅͘ʮGit͕֮͑ͯͯ͘ΕΔ͔ Βʂʂʂʂʂʂoldͱ͔΍Ί Ζʂʂʂʂʂʂʂʂʂʂʯ

  6. ͳΜͱ͔खॱॻ_draft.docx

  7. ΅͘ʮdraft͸ϒϥϯν੾ͬͯ ΍ΕΑʂʂʂʂʂͬ͞͞ͱ rename͠Ζʂʂʂʂʂʯ

  8. νʔϜ಺ͷGitྗ޲্͕՝୊ • Git͸ϑΝΠϧαʔό͡Όͳ͍ʂʂʂ • master௚push΍ΊΖʂʂʂ • खॱॻϨϏϡʔϓϩηεΛMRͰ΍Γ͍ͨɻɻ • ->ͭ·Γdiff͕͏·͘ग़ͳ͍WordΛ͜Ζ͢

  9. $ git init > Initialized empty Git repository in /Users/take/

    gitlab/.git/
  10. $ ls .git > HEAD config description hooks info objects

    refs
  11. .gitɺ͋Γ·͢Ͷʁ

  12. .gitɺ͋Γ·͢Α

  13. .git • Git͸͢΂ͯͷ؅ཧ৘ใΛ.gitҎԼʹू໿ • .gitͷதΛݟ͍ͯ͘͜ͱͰɺͲ͏΍ͬͯόʔ δϣϯ؅ཧΛ࣮ݱ͍͔ͯ͘͠ݟ͍ͯ͘

  14. gitͷΦϒδΣΫτ CMPC ϑΝΠϧͷσʔλ USFF CMPC΁ͷࢀরͱɺ ֊૚෼ͷσΟϨΫτϦ৘ใ DPNNJU มߋ࣌ͷϝλσʔλͱɺ USFF΁ͷࢀর UBH

    DPNNJU΁ͷࢀর
  15. gitͷΦϒδΣΫτ GitӳจϚχϡΞϧΛಡΉͨΊͷ༧උ஌ࣝ
 http://tokkonopapa.github.io/blog/2012/01/17/prior-knowledge-for-git-manual/

  16. ςΩετϑΝΠϧͷ৔߹ $ echo "hello git" > hello_git.txt $ git add

    hello_git.txt $ git commit -m "hello git” [master (root-commit) aaa6ce7] hello git 1 file changed, 1 insertion(+) create mode 100644 git_test/hello_git.txt > Ҏ߱͸σϞͰʂ
  17. όΠφϦϑΝΠϧͷ৔߹ ը૾ϑΝΠϧͷมߋ > Ҏ߱͸σϞͰʂ https://pixlr.com/editor/

  18. εφοϓγϣοτ΍Μʂ ࠩ෼؅ཧ͡Όͳ͍΍Μʂ

  19. git gc

  20. git-gcͱpackfile • git-gcʹΑΓطଘͷΦϒδΣΫτ͸࡟আ͞Εɺ pack-*.idxͱpack-*.packϑΝΠϧ͕ੜ੒ • ͨͿΜ͜͜Ͱdeltaѹॖͯ͠Δ

  21. େ༰ྔϑΝΠϧΛߋ৽ͯ͠ΈΔ $ sec 1 10000000 > sec.txt $ git gc

    Counting objects: 18, done. Delta compression using up to 4 threads. Compressing objects: 100% (14/14), done. Writing objects: 100% (18/18), done. Total 18 (delta 3), reused 11 (delta 0) > Ҏ߱͸σϞͰʂ
  22. όΠφϦϑΝΠϧͷԿ͕μϝʁ • ୯ʹdiff͕ݟΕͳ͍ • merge࣌ʹconflict͢Δͱࢮ͵ • ࠩ෼͕ଟ͘ग़ΔՄೳੑ͕͋ΔͷͰɺpackʹΑ Δѹॖޮ཰͕ѱ͍

  23. ·ͱΊ • ຊ౰ʹͯ͠͸͍͚ͳ͍ͷ͸ʮڊେόΠφϧϑΝΠϧʯ ͷadd • -> Git LFS΁Ͳ͏ͧ • commit͸εφοϓγϣοτ(blog)Λੜ੒͠ɺpackͰ

    ࠩ෼อଘʹΑΔѹॖ • ͦΕҎ֎͸શͯࢀরͷϦϨʔ
  24. ͓·͚ɿWord͸όΠφϦͱ͍ ͏Θ͚Ͱ͸ͳ͍ • Wordͷத਎͸zip͞Εͨxml • ͔ͩΒgitͰdiffͱΔͱԿ͔͠Βݟ͑Δ • ࢀߟɿWord͞Μ͸ࠓ೔΋͓͔ͭΕͰ͢ • http://qiita.com/kaityo256/items/

    c15889dbb7acb2632c6e
  25. Reference • ΤϯδχΞͷͨΊͷGitͷڭՊॻʦ্ڃฤʧ Git಺෦ͷ࢓૊ΈΛཧղ͢Δ • https://www.amazon.co.jp/exec/obidos/ASIN/B01AAIN85K/ takeshe11-22/ • ʮΤϯδχΞͷͨΊͷgitڭՊॻʯ͔Βgitͷ಺෦ߏ଄ΛֶͿɹ࣮ફฤͦͷ1 •

    http://take-she12.hatenablog.com/entry/2017/08/10/120000 • ʮΤϯδχΞͷͨΊͷgitڭՊॻʯ͔Βgitͷ಺෦ߏ଄ΛֶͿɹ࣮ફฤͦͷ2 • http://take-she12.hatenablog.com/entry/2017/08/12/120000