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

Gitで始めるバージョン管理

arm4
September 21, 2018

 Gitで始めるバージョン管理

arm4

September 21, 2018
Tweet

More Decks by arm4

Other Decks in Technology

Transcript

  1. repository ʲ໊ʳ 1. ऩೲʦอଘʧ৔ॴɺ૔ݿ 2. ത෺ؗɺඒज़ؗ 3. ஍Լຒ૴ॴɺ෿ุ 4. ʤ஌ࣝͳͲͷʥๅݿɺ๛෋ͳ஝͑


    ɾA griot in West Africa is a repository of oral tradition. : ੢ΞϑϦΧͷάϦΦ͸ޱ ಄఻ঝͷๅݿͰ͋Δɻ 5. ʤൿີΛଧͪ໌͚ΒΕΔʥ৴པͰ͖Δਓ
  2. ෺ཧతͳ৔ॴ /.git
 ~ /objects index
 ~ index.html /images /css /js

    ϫʔΩϯά
 σΟϨΫτϦ εςʔδϯά ΤϦΞ ϦϙδτϦ
  3. ϑΝΠϧͷঢ়ଶΛදུ͢ه ?? = untracked ' ' = unmodified M =

    modified A = added D = deleted R = renamed C = copied U = updated but unmerged
  4. ศརͳlogͷΦϓγϣϯ git log -p
 diffΛՃ͑ͨίϛοτϩάʢύονΛදࣔʣ git log -2
 දࣔ͢Δίϛοτϩάͷ਺Λࢦఆ git

    log --stat
 มߋ͞ΕͨϑΝΠϧΛදࣔ(౷ܭ৘ใɺεςʔλεΛදࣔ) git log --pretty=oneline
 ίϛοτϩάΛ̍ߦͰදࣔ git log --pretty=format:"%h - %an, %ar : %s"
 ϋογϡ - ίϛοτͨ͠ਓͷ໊લ, ૬ର೔෇ : ໊݅
  5. git log --graph
 ϒϥϯνͷϚʔδཤྺΛΞεΩʔάϥϑͰදࣔͯ͘͠ΕΔ git log --since=2weeks
 git log --since=2018-06-07


    ͍͔ͭΒͰҾֻ͚ͬΔ git log --until=2weeks
 ͍ͭ·ͰͰҾֻ͚ͬΔ git log --author=beruko
 ίϛοτͨ͠ਓͰҾֻ͚ͬΔ git log --grep=ސ٬
 ໊݅ͰҾֻ͚ͬΔ git log database/seeds/MenuSeeder.php
 มߋͷ͋ͬͨϑΝΠϧͷύεͰҾֻ͚ͬΔ git log --pretty="%h %an -%s" --author=nto --since="2018-05-01" -- until="2018-05-31"
 2018೥5݄ʹnto͞Μͷίϛοτͨ͠ཤྺͷΈΛදࣔ
  6. ༷ʑͳdiffΛදࣔ͢Δ git diff
 ݱࡏͷϫʔΫσΟϨΫτϦͱεςʔδϯάΤϦΞͱͷࠩ෼Λදࣔ git diff --cached
 git diff --staged


    εςʔδϯάΤϦΞͱ࠷৽ͷίϛοτ(HEAD)ͱͷࠩ෼Λදࣔ git diff HEAD
 ݱࡏͷϫʔΫσΟϨΫτϦͱ࠷৽ͷίϛοτ(HEAD)ͷࠩ෼Λදࣔ͢Δ git diff HEAD^
 git diff HEAD^..HEAD
 ࠷৽ͷίϛοτͱ࠷৽ͷίϛοτͷͻͱͭલͱͷࠩ෼Λදࣔ͢Δ git diff <ίϛοτϋογϡ>
 ݱࡏͷϫʔΫσΟϨΫτϦͱಛఆͷίϛοτͱͷࠩ෼Λදࣔ
  7. git diff <ίϛοτϋογϡ>..<ίϛοτϋογϡ>
 ίϛοτಉ࢜Λൺֱͨࠩ͠෼Λදࣔ git diff <ϒϥϯν໊>..<ϒϥϯν໊>
 ϒϥϯνಉ࢜ͷࠩ෼Λදࣔ git diff

    -- <ϑΝΠϧͷύε>
 ಛఆͷύεͷΈͷdiffΛදࣔɻύεͷΈࢦఆ͢Δ৔߹͸--͸লུ Մೳ git diff <ϒϥϯν໊>..<ϒϥϯν໊> -- <ϑΝΠϧͷύε>
 ಛఆͷϑΝΠϧΛผͷϒϥϯνͱൺֱͨࠩ͠෼Λදࣔ git diff --word-diff
 ࠩ෼ΛจࣈϨϕϧͰൺֱ͢Δ git diff --diff-filter=M
 मਖ਼ͨ͠ϑΝΠϧͷdiffͷΈΛදࣔ͢ΔΦϓγϣϯ