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

知っておいてほしいGitの本当の基礎 / Let's know Git

知っておいてほしいGitの本当の基礎 / Let's know Git

コミットの連なりと.gitの中身について @miyaoka

社内勉強会向けに作った資料

Masaya Kazama

March 24, 2017
Tweet

More Decks by Masaya Kazama

Other Decks in Technology

Transcript

  1. ͜ͷͱ͖ɺ࣮ࡍ͸ʜ "EEJOEFYpMF $ # " "EEJOFEYpMF $` )&"% w ίϛοτΛॻ͖׵͑ͨͷͰ͸ͳ͘ɺผͷ৽͍͠ί

    ϛοτΛ࡞ͬͯͦͪΒʹ)&"%ΛҠ͍ͯ͠Δ w ݩͷίϛοτ͸ḷΕͳ͘ͳͬͨͷͰπϦʔද͔ࣔ Β͸ফ͑Δ w ͳͷͰॻ͖׵ΘͬͨΑ͏ʹΈ͑Δ w දࣔ͞Εͳ͘ͳͬͯ΋಺෦తʹ࢒Γଓ͚Δ
  2. ͜͏͍͏΋ͷͳΜͰ͢ $ # " % & $` #` %` &`

    w Ұ౓࡞ͬͨίϛοτ͸ʢجຊతʹʣॻ͖׵ ΘΒͳ͍ w ৽͍͠ίϛοτ͸*%͕มΘΔ w ਌*%͕มΘΔͷͰɺͨͱ͑ͦͷଞͷ಺༰͕ શ͘ಉ͡Ͱ΋৽͍͠ίϛοτͱͯ͠࡞Γ௚ ͞ΕΔ w ͭ·ΓͲ͔͜࡞Γ௚ͨ͠Β͔ͦ͜Βޙͷί ϛοτ͸࿈࠯తʹશͯ࡞Γ௚͠ʹͳΔ มߋͨ͠ ਌*%͕มΘͬͨ ͷ͔ͦ͏͔ ਌*%͕มΘͬͨ ͷ͔ͦ͏͔ ਌*%͕มΘͬͨ ͷ͔ͦ͏͔
  3. ϒϥϯνΛ෇͚௚͢ $ # " % & EFWFMPQ HJUSFqPH CCB)&"%!\^ʜ FCDDF)&"%!\^ʜ

    GCCC)&"%!\^ʜ HJUCSBODIOFXCSBODICCB OFXCSBODI w ίϛοτ͸ݟ͑ͳ͘ͳ͚ͬͨͩͰɺ࣮ࡍʹ͸ ফ͍͑ͯͳ͍ w )&"%ͷϩάͳͲ͔Βίϛοτ*%Λݟ͚ͭग़ ͯͦ͜͠ʹ৽ͨʹϒϥϯνͳͲΛ͚ͭΕ͹· ͨදࣔ͞ΕΔΑ͏ʹͳΔ
  4. ϑΝΠϧΛ࡞੒ͯ͠௥Ճ SFGT HJU )&"% JOEFY PCKFDUT E B XPSLJOHEJSFDUPSZ pMFUYU

    MPHT FDIPpMFDPOUFOUpMFUYU HJUBEEpMFUYU 4)"ͷ*%͔ΒʮσΟϨΫτ Ϧ໊ ϑΝΠϧ໊ʯͷϑΝΠϧ ʹ಺༰͕֨ೲ͞ΕΔ ݱࡏεςʔδ͞Ε͍ͯΔϑΝΠ ϧπϦʔ৘ใ ͜ͷ಺༰ͱϫʔΫϑΝΠϧΛ ൺֱͯࠩ͠෼͕දࣔ͞ΕΔ
  5. ࠷ॳͷίϛοτ SFGT IFBET NBTUFS HJU )&"% JOEFY PCKFDUT FC DDF

     B E  XPSLJOHEJSFDUPSZ pMFUYU MPHT )&"% SFGT IFBET NBTUFS HJUDPNNJUNlJOJUJBMDPNNJUz lFCDDFz ϒϥϯν͕ࢦࣔ͠͠ ͍ͯΔઌͷίϛοτ *% lSFGSFGTIFBET NBTUFSz ݱࡏϦϙδτϦͷͲ͜ Λࢀর͍ͯ͠Δͷ͔ͱ ͍͏ϙΠϯλ FCDDFNBTUFS!\^DPNNJU JOJUJBM JOJUJBMDPNNJU FCDDF)&"%!\^DPNNJU JOJUJBM JOJUJBMDPNNJU
  6. w (JUΦϒδΣΫτͷߏ੒ΛݟͯΈΑ͏ HJUDBUpMFQFCDDF USFFBFCCDGECBEBDEEB BVUIPS.BTBZB,B[BNB  DPNNJUUFS.BTBZB,B[BNB  JOJUJBMDPNNJU HJUDBUpMFQB

    CMPCEBCDBBBEGFpMFUYU HJUDBUpMFQE pMFDPOUFOU PCKFDUT FC DDF  B E  ࠷ॳͷίϛοτͷத਎ $PNNJU0CKFDU ίϛοτ৘ใ 5SFF0CKFDU ϑΝΠϧϦετ৘ใ #MPC0CKFDU ϑΝΠϧͷத਎ NBTUFS
  7. ϒϥϯνͷ࡞੒ SFGT IFBET NBTUFS EFW HJU )&"% JOEFY PCKFDUT FC

    DDF  B E  XPSLJOHEJSFDUPSZ pMFUYU MPHT )&"% SFGT IFBET NBTUFS EFW HJUCSBODIEFW FCDDF ϒϥϯνʹ৽͍͠ϙΠϯλ͕௥Ճ͞ΕΔɻ ͜ͷ࣌఺Ͱ͸NBTUFSͱಉҰ FCDDFEFW!\^CSBODI$SFBUFEGSPNNBTUFS
  8. ϒϥϯνͷ੾Γସ͑ SFGT IFBET NBTUFS EFW HJU )&"% JOEFY PCKFDUT FC

    DDF  B E  XPSLJOHEJSFDUPSZ pMFUYU MPHT )&"% SFGT IFBET NBTUFS EFW HJUDIFDLPVUEFW SFGSFGTIFBETEFW )&"%ͷࢀরઌΛมߋ͢Δ ͜ͱͰϒϥϯν͕มΘΔ FCDDF)&"%!\^DIFDLPVUNPWJOHGSPNNBTUFSUPEFW FCDDF)&"%!\^DPNNJU JOJUJBM JOJUJBMDPNNJU
  9. ճ໨ͷίϛοτ SFGT IFBET NBTUFS EFW HJU )&"% JOEFY PCKFDUT G

    CCC FG BGFF  CE FC  E XPSLJOHEJSFDUPSZ pMFUYU pMFUYU MPHT )&"% SFGT IFBET NBTUFS EFW FDIPpMF@UYUpMFUYU HJUBEEpMFUYU HJUDPNNJUNlBEEpMFz GCCC)&"%!\^DPNNJUBEEpMF FCDDF)&"%!\^DIFDLPVUNPWJOHGSPNNBTUFSUPEFW FCDDF)&"%!\^DPNNJU JOJUJBM JOJUJBMDPNNJU GCCCEFW!\^DPNNJUBEEpMF FCDDFEFW!\^CSBODI$SFBUFEGSPNNBTUFS GCCC ৽͍͠ίϛοτʹϙΠϯλ ͕ॻ͖׵ΘΔ
  10. w ॳճͱҧ͏ͱ͜Ζ HJUDBUpMFQGC USFFCEFBBEFCCFCC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