Slide 1

Slide 1 text

Git Bootcamp 2017, 12th April @ Recruit Technologies

Slide 2

Slide 2 text

Git Bootcamp • ΧϦΩϡϥϜ • Git-it Ͱ Git ͷ࢖͍ํΛମܥతʹֶͿ • Git Tips ू • ͜Μͳ࣌Ͳ͏͢Δʁ Git ԋशฤ • ࣮ࡍʹGitHubͰNode.jsʹίϯτϦϏϡʔτͯ͠ΈΔ

Slide 3

Slide 3 text

Gitͱ͸ • ෼ࢄόʔδϣϯ؅ཧγεςϜ • "෼ࢄ"ͷ෦෼ʹ͔ͳΓ஫ྗ͞ΕͯΔ • ࠓ΍։ൃऀ಺Ͱͷdefact standard

Slide 4

Slide 4 text

Git Χϧλ • GitͷΠϝʔδΛڧԽͤ͞ΔͨΊͷΧϧλ • ্ख͘ΠϝʔδΛͭͳ͛ΒΕΔͰ͠ΐ͏͔

Slide 5

Slide 5 text

A B C D

Slide 6

Slide 6 text

໰୊

Slide 7

Slide 7 text

A B C D git checkout -b fix/42

Slide 8

Slide 8 text

A B C D git checkout -b fix/42; git commit

Slide 9

Slide 9 text

A B C D git merge --ff-only

Slide 10

Slide 10 text

A B C D git merge --no-ff

Slide 11

Slide 11 text

΋ͬͱ׳Ε͍͖ͯ·͠ΐ͏

Slide 12

Slide 12 text

Git it Λ࣮ߦ͢Δ • Լهͷͱ͜Ζ͔Βμ΢ϯϩʔυ࣮ͯ͠ߦ • https://github.com/jlord/git-it-electron/releases • ΞϓϦέʔγϣϯϑΥϧμͷԼʹgit-itΛ഑ஔ্ͨ͠Ͱ ࣮ߦ͍ͯͩ͘͠͞ • securityͷΤϥʔ͕ग़ͨΒઃఆ>ηΩϡϦςΟͱϓϥΠ όγ>μ΢ϯϩʔυͨ͠ΞϓϦέʔγϣϯͷ࣮ߦڐՄ> ͢΂ͯͷΞϓϦέʔγϣϯΛڐՄʢ͋ͱͰ໭ͯ͠Ͷʣ

Slide 13

Slide 13 text

Git it Λ࣮ߦ͢Δ • େମ1࣌ؒ͘Β͍Λ໨҆ʹશ෦ճ౴͍ͯͩ͘͠͞ɻ • git ͷίϚϯυʹ৮Εͭͭ΋͜ͷػձʹGitHubͷ ΞΧ΢ϯτ͕ͳ͍ਓ͸࡞͓͖ͬͯ·͠ΐ͏ɻ • ૣ͍ਓͰ1࣌ؒ͘Β͍ɺ஗ͯ͘΋2࣌ؒ͘Β͍Ͱऴ ΘΔҹ৅Ͱ͕͢ɺऴΘΓํ࣍ୈͰ࣍ͷΧϦΩϡϥ ϜΛܾΊ·͢ɻ

Slide 14

Slide 14 text

͍͍ͩͨΈΜͳ͕ऴΘͬͨΒ ࣍ʹਐΈ·͢

Slide 15

Slide 15 text

ͦͷલʹ • ΈΜͳͷҙݟ͕ฉ͍ͯΈ͍ͨ • GitͬͯҰޱʹݴͬͯ΋ΈΜͳ͕஌Γ͍ͨॴ΍ ࠔͬͯΔͱ͜ΖΛڞ༗͓͖͍ͯͨ͠ • ͦͷ্Ͱ๻͕Θ͔Δ஌ݟΛڞ༗͢Δ

Slide 16

Slide 16 text

Git খ࢙

Slide 17

Slide 17 text

NOTE: ͜Ε͔Β࿩͢࿩͸શ͘໾ʹཱ ͪ·ͤΜɻ ιϑτ΢ΣΞখ࿩ͱͯ͠ฉ͍ ͍ͯͩ͘͞ɻ

Slide 18

Slide 18 text

Gitখ࢙ • Linus TorvaldsɺLinuxΛ࡞ͬͨࠓΛੜ͖Δι ϑτ΢ΣΞͷ఻આ͕LinuxͷΧʔωϧΛ؅ཧ͢ ΔͨΊʹ2िؒͰ։ൃͨ͠ͷ͕Git

Slide 19

Slide 19 text

Gitখ࢙ • Before Git: 90೥୅ޙ൒ɺLinuxΧʔωϧί ϛϡχςΟ͸ͱ͋Δ໰୊ʹৗʹ೰·͞Ε͍ͯͨ • ͱ͋Δ໰୊ͱ͸ɺΧʔωϧ։ൃऀ͕ଟ͘ͳͬͯ ͖ͨ͜ͱʹ΋ؔΘΒͣɺશһ͕ϋοϐʔʹͳΔ SCM(Software Configuration Management) πʔϧ͕ଘࡏ͠ͳ͍͜ͱͰ͢ɻ

Slide 20

Slide 20 text

Gitখ࢙ • Before Git: Linus Torvalds ͸ CVS Λௐࠪ͠ ·ͨ͠ɻ͔ͦ͠͠ͷ݁Ռ͸ɻɻɻ

Slide 21

Slide 21 text

Gitখ࢙ • Before Git: Linus Torvalds ͸ CVS Λௐࠪ͠ ·ͨ͠ɻ͔ͦ͠͠ͷ݁Ռ͸ɻɻɻ ࠷ѱ

Slide 22

Slide 22 text

Gitখ࢙ • Before Git: tarball, diff, patch Ͱӡ༻͢Δ ΋ɺࣗ෼ͰίϯϑϦΫτղফͨ͠Γɺpatchͷ ϚʔδΛͨ͠Γͯͨ͠ͷͰɺɺɺ ແཧʂ

Slide 23

Slide 23 text

Ұํͦͷࠒ

Slide 24

Slide 24 text

Gitখ࢙ • Before Git: Larry McVoy (Sun Microsystems ͷΤϯδχΞ)͕BitKeeperͱݺ͹ΕΔ෼ࢄ όʔδϣϯ؅ཧγεςϜΛ࡞Δ Hey Linus! ͜ΕͲ͏ΑʁLinux։ൃʹऔΓೖΕͯ Έͳ͍ʁ

Slide 25

Slide 25 text

Gitখ࢙ • Larry McVoy: BitKeeper Λ࡞ΔͨΊͷձࣾͰ ͋Δ BitMover Λ࢝ΊΔɻ BitKeeper ࢖ͬͯ޿Ίͯ͘Εʔ

Slide 26

Slide 26 text

Gitখ࢙ • Linusୡ͸BitKeeperΛ࢖͍࢝Ίɺ݁Ռͱͯ͠ LinuxΧʔωϧϋοΧʔͷଟ͘͸ϋοϐʔʹɻ BitKeeper ͍͍͡ΌΜ

Slide 27

Slide 27 text

͔͠͠

Slide 28

Slide 28 text

Gitখ࢙ • BitKeeperʹ͸ผͳ໰୊͕͋Γ·ͨ͠ • BitKeeperͷϥΠηϯε͸एׯ෩มΘΓ • BitKeeper͸OSSʹ΋ؔΘΒͣɺϑϦʔͰ࢖͏ ͨΊʹ͸શͯͷChangeLogΛެ։͠ͳ͍ͱ͍ ͚ͳ͍ͱ͍͏΋ͷ

Slide 29

Slide 29 text

Gitখ࢙ • ΤϯλʔϓϥΠζͰBitKeeperΛ࢖͏ʹ͸঎༻ ϥΠηϯεΛങͬͯprivateͰӡ༻͢Δඞཁ͕ ͋Δ • BitKeeperΛforkͯ͠উखʹެ։͞Εͳ͍Α͏ ͳpatchΛద༻͢Δౕ΋ग़͖ͯͯϥΠηϯεҧ ൓Λ๷͖͗Εͳ͘ͳΔڪΕ΋͋ͬͨ

Slide 30

Slide 30 text

Gitখ࢙ • ఔͳͯ͘͠BitKeeperͷιʔείʔυ͸Open Ͱ͸ͳ͘ͳͬͯ͠·ͬͨɻ BitKeeperͷίʔυ͸OSSͰ͸ͳ͘͠·͢

Slide 31

Slide 31 text

Gitখ࢙ • LinuxΧʔωϧͷϝϯόʔ͸͜Εʹࠔ࿭͠·͠ ͨɺLinuxͱ͍͏OSSͷਃ͠ࢠͱ΋ݴ͏΂͖ ιϑτ΢ΣΞͷιʔε͸OSSͰ؅ཧ͞Ε͍ͯ ͳ͍ͷͰ͢ɻ

Slide 32

Slide 32 text

Gitখ࢙ • Linus͔Β͢Ε͹ιʔείʔυ͕؅ཧͰ͖Ε͹ ͍͍ͷͰͦͷลͷ໰୊͸ಛʹؾʹͯ͠ͳ͔ͬ ͕ͨɺBitKeeperͷ໰୊͸ͦͷ··फڭɾ੓࣏ ࿦૪ʹͳ͍͖ͬͯ·ͨ͠ɾɾɾ ໰୊͕͋ΔͳΒ΋ͬͱ͍͍ͷ Λ࡞ͬͯ͘ΕΑ

Slide 33

Slide 33 text

Gitখ࢙ • Andrew Tridgell: rsync/Sambaͷ࡞ऀ BitKeeperͷϦόʔεΤϯδχ ΞϦϯάͯ͠৽͍͠ͷ࡞Ζ͏

Slide 34

Slide 34 text

Gitখ࢙ • BitKeeperΛΤϛϡϨʔτ͢ΔίʔυΛॻ͍ͯ ׬શʹϦόʔεΤϯδχΞϦϯά͢Δମ੍ • ͦΕʹؾ͍ͮͨBitKeeperଆ͸҉߸ԽͳͲͰର ࡦ • LinuxଆͱBitKeeperଆͷؔ܎͸ѱԽ͍͖ͯ͠ ·ͨ͠

Slide 35

Slide 35 text

Gitখ࢙ • LinusͷݟղɿBitKeeperΛ௒͑Δ΋ͬͱ͍͍ ΋ͷΛ࡞ͬͯͳ͍ɺ΍ͬͯΔ͜ͱ͸Πλζϥʹ ؔ܎ΛѱԽ͍ͤͯ͞Δ͚ͩͩɻ फڭɾ੓࣏࿦૪͸͏Μ͟Γͩ

Slide 36

Slide 36 text

Gitখ࢙ • Larry / Linus ͸2005೥ʹి࿩ͰձٞΛ͠ɺ௕ ࣌ؒͷٞ࿦ͷ຤ɺBitKeeperΛLinuxͰ͸࢖Θ ͳ͍ࣄ͕ܾ·Γ·ͨ͠ɻ ܾผͷ࣌

Slide 37

Slide 37 text

Gitখ࢙ • ͔ͦ͜ΒͷLinusͷಈ͖͸ߴ଎Ͱͨ͠ɻ • ͍͔ͭ͘طଘͷ෼ࢄ؅ཧγεςϜΛௐࠪ͠ɺ ࢖͍෺ʹͳΒͳ͍ͱ൑அ • ϑϧεΫϥονͰॻ͖௚͢͜ͱʹܾఆ

Slide 38

Slide 38 text

Gitখ࢙ • 1೔Ͱಈ͘ͱ͜Ζ·Ͱ࡞Γɺ2೔໨Ͱgitʹର͠ ͯgitͦͷ΋ͷΛίʔυ؅ཧͤ͞Δ͜ͱʹ੒ޭ (self hosting) • 2िؒޙʹ͸LinuxΧʔωϧΛ͜ΕͰ؅ཧ͠Α ͏ͱϝʔϦϯάϦετʹpost • ໿2िؒͰgit͕Ͱ͖ͨͱݴΘΕ͍ͯΔ

Slide 39

Slide 39 text

Gitখ࢙ $ git log e83c516 commit e83c5163316f89bfbde7d9ab23ca2e25604af290 Author: Linus Torvalds Date: Thu Apr 7 15:13:13 2005 -0700 Initial revision of "git", the information manager from hell

Slide 40

Slide 40 text

Gitখ࢙ • 4݄3೔͔Β։ൃΛ࢝Ίͯɺ4݄7೔ʹ͸ͳΜΒ ͔ͷ΋ͷ͕ಈ͍͍ͯͯɺ4݄16೔ʹ͸linux ΧʔωϧΛ֨ೲͰ͖Δ·ͰʹͳΔɻ͜Ε͕2ि ؒ଍ΒͣͰgitΛ࡞ͬͨͱݴΘΕΔΏ͑ΜͰ͋ Δɻ

Slide 41

Slide 41 text

Git খ࿩

Slide 42

Slide 42 text

Gitখ࿩ • gitͷMLͰɺͳͥgitͰC++Λ࢖Θͳ͍ͷ͔ͱ͍ ͏࣭໰ʹରͯ͠ɺLinusͷճ౴ > > GitͷιʔείʔυΛ࢝ΊͯΈͨ࣌ɺ2ͭͷ͜ͱ͕಄ʹͻ͔͔ͬͬͨɻ > 1. C++͡Όͳͯ͘७ਮͳCɻཧ༝͸ෆ໌ɻҠ২ੑͱ͔ݴΘͳ͍ͰΑɻ > Ϋιͩɻ Ϋι·ΈΕͳͷ͸Φϝʔͷํͩɻ C++͸൵ࢂͳݴޠͩɻ͔͠΋ɺগͳ͔Β͵਺ͷϓϩάϥϚʔ͕࢖͍ͬͯͯɺ׬શແܽͷͲ͏͠Α͏΋ͳ͍Ϋι Λੜ੒͢Δͷ͕ΊͪΌΊͪΌ؆୯ʹͳ͍ͬͯΔͱ͍͏఺ͰɺΑ͚͍ʹ൵ࢂͩɻϚδͰɺCΛબ୒͢Δཧ༝͕ ʮԿ΋ͳ͔ͬͨʯͱͯ͠΋ͩɺC++ϓϩάϥϚʔආ͚ʹͳΔͱ͍͏͚ͩͰɺCΛ࢖͏େ໊ٛ෼ʹͳΔɻ

Slide 43

Slide 43 text

Git Tipsू

Slide 44

Slide 44 text

Git Tips • ๻͕GitΛ࢖͏্Ͱ΍͍ͬͯΔࣄΛڭ͑ͯ஌ݟ Λڞ༗͠·͢

Slide 45

Slide 45 text

Git Tips ͦͷ1: Tig

Slide 46

Slide 46 text

Git Tips ͦͷ1: Tig • gitΛ࢖͍΍͘͢͢Δπʔϧ • ݸਓతʹ͸͜Ε͕ͳ͍ͱgit࢖͑ͳ͍͍ͬͯ͏ Ґ࢖͍΍͍͢ • tig Ͱ add ͨ͠Γ tig ͰऔΓফͨ͠Γ͢ΔͷΛ Α͘΍Δ

Slide 47

Slide 47 text

DEMO

Slide 48

Slide 48 text

Git Tips ͦͷ2: git hook

Slide 49

Slide 49 text

Git Tips ͦͷ2: git hook • git Ͱίϛοτ࣌΍push࣌ʹίϚϯυΛ࣮ߦ ͢Δπʔϧ • node.jsϓϩδΣΫτͰ͸husky͍ͬͯ͏πʔ ϧ͕͋ͬͯͦΕΛ࢖ͬͯhookͤ͞Δ͜ͱ͕ଟ ͍

Slide 50

Slide 50 text

DEMO

Slide 51

Slide 51 text

Git Tips ͦͷ3: git diff algorithm

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

git diff --histogram ΋͋Δ

Slide 55

Slide 55 text

͜Μͳͱ͖Ͳ͏͢Δʁ Git͓ࠔΓ࣌ͷϔϧϓ

Slide 56

Slide 56 text

͏͔ͬΓؒҧͬͯadd/commit ͯ͠͠·ͬͨ΋ͷΛݩʹ໭͢

Slide 57

Slide 57 text

͏͔ͬΓؒҧͬͯadd/commit ͨ͠ͱ͖ # git reset Λ࢖͍·͠ΐ͏ $ git reset --soft HEAD^ // ҰݸલͷίϛοτΛऔফ͠ $ git reset --soft HEAD^^ // ೋݸલͷίϛοτΛऔΓফ͢ # ͪͳΈʹ tig Ͱ΍Δͱ add ͷ৔߹͸΋ͬͱ؆୯ $ tig status

Slide 58

Slide 58 text

͏͔ͬΓؒҧͬͯpushͯ͠͠ ·ͬͨ΋ͷΛݩʹ໭͢

Slide 59

Slide 59 text

͏͔ͬΓؒҧͬͯpushͨ͠ͱ͖ # ·ͣɺνʔϜ։ൃத͸ master ΁ͷ௚push͸ۃྗආ͚Δ (Pull RequestϕʔεͰશһ͕؂ ࢹͰ͖ΔΑ͏ʹ͠ͳ͕Β։ൃ͢Δʣ # masterҎ֎ͷϒϥϯνʢࣗ෼ͷϒϥϯνͳΒpushͯ͠΋औΓฦ͕ͭ͘͠ʣ # master ͷ৔߹ɺͦͷλΠϛϯάͰclone͞ΕͨΓpull͞ΕͨΓ͢Δͱඇৗʹ໘౗ͳ͜ͱʹ ͳΔ $ git rebase -i Ͱpushͯ͠͠·ͬͨίϛοτΛऔΓফ͢ $ ͜ͷ git rebase ͕ΊͬͪΌ࢖͏ $ git rebase -i ͢ΔͱΤσΟλ͕։͘ͷͰɺͦͷΤσΟλ্Ͱ֘౰ίϛοτΛ࡟আ $ ࡟আͨ͠Β git push -f Ͱforce push $ master ΁ͷ force push ͸ݫېͳ͕࣌͋ΔͷͰඇৗʹؾΛ͚ͭΔ

Slide 60

Slide 60 text

͏͔ͬΓؒҧͬͯmaster mergeͯ͠͠·ͬͨ΋ͷΛݩ ʹ໭͢

Slide 61

Slide 61 text

͏͔ͬΓؒҧͬͯmaster merge ͨ͠ͱ͖ # جຊ͸ revert ͢Δ # master ʹpush͞Εͨ΋ͷΛ҆શʹऔΓফ͢ͷ͸revertͰ΍Δͷ͕ྑ͍ # ͨͩ͠ɺrevert͢Δͱrevert commit(औΓফͨ͢Ίͷcommit͕ͭ͘) # git ͷຊདྷతͳ࢖͍ํͱͯ͠͸revert͕ਖ਼͍͠ $ git revert HEAD~2 (ೋݸલͷίϛοτΛrevert)

Slide 62

Slide 62 text

ผͷϒϥϯν͔Βίϛοτ͠ ͯ͠·ͬͨͷͰऔΓࠐΈ͍ͨ

Slide 63

Slide 63 text

ผͷϒϥϯν͔Βίϛοτͯ͠ ͠·ͬͨͷͰऔΓࠐΈ͍ͨ # cherry pick # ίϛοτͨ͠΋ͷΛcherry-pickͯ͠ผϒϥϯνʹ΋ίϛοτͨ͜͠ͱʹ͢Δ $ git cherry-pick <ίϛοτ൪߸> # pushͯ͠ͳ͚Ε͹Ұ୴reset --soft ͯͦ͠ΕΛผϒϥϯνʹͯ͠push͢Δํ͕ଟ͍͔΋ɻ

Slide 64

Slide 64 text

ίϛοτͨ͋͠ͱͰtypo͕ ͋ͬͯtypoͨ͠Βtypo͕typo ͯͨ͠

Slide 65

Slide 65 text

ίϛοτͨ͋͠ͱͰtypo͕͋ͬͯ typoͨ͠Βtypo͕typoͯͨ͠ # git log fix: typo fix: typo feat: Add new feature Έ͍ͨͳͱ͖ # git rebase -i HEAD~{3} ͔ͯ͠Β औΓࠐΈ͍ͨ΍ͭͱऔΓࠐΈͨ͘ͳ͍΍ͭΛ෼͚ͯϚʔδ͢Δ

Slide 66

Slide 66 text

ίϛοτͨ͋͠ͱͰtypo͕͋ͬͯ typoͨ͠Βtypo͕typoͯͨ͠ ίϛοτϝοηʔδΛ fixup ͱ͔ squash ʹ͓ͯ͘͠ͱ git rebase -i --autosquash Ͱϋο ϐʔʹͳΔ git commit --fixup Ͱ΋ྑ͍ ※ autosquashΛ࢖͏࣌͸௚લͷίϛοτͷϝοηʔδͷઌ಄਺จࣈؚ͕·Ε͍ͯΔඞཁ͕ ͋Δɻ

Slide 67

Slide 67 text

Trial github.com/recruit-tech/git- bootcamp

Slide 68

Slide 68 text

passwordΛ͏͔ͬΓೖΕ ͪΌͬͨͷͰաڈͷίϛοτ ͔Βશͯ࡟আ͍ͨ͠

Slide 69

Slide 69 text

passwordΛ͏͔ͬΓೖΕͪΌͬͨͷ Ͱաڈͷίϛοτ͔Βશͯ࡟আ͍ͨ͠ # git filter-branch Λ࢖͏ $ git filter-branch -f --tree-filter 'rm -f password.txt' HEAD $ git push origin master --force

Slide 70

Slide 70 text

Trial github.com/recruit-tech/git- bootcamp

Slide 71

Slide 71 text

git commit Ͱ࢖ͬͨemail/ nameΛม͍͑ͨ

Slide 72

Slide 72 text

passwordΛ͏͔ͬΓೖΕͪΌͬͨͷ Ͱաڈͷίϛοτ͔Βશͯ࡟আ͍ͨ͠ # git filter-branch ͷ commit-filter Λ࢖͏ $ git filter-branch -f --commit-filter 'if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ]; then GIT_AUTHOR_NAME="Yochan"; GIT_AUTHOR_EMAIL="[email protected]"; git commit-tree "$@"; else git commit-tree "$@"; fi' HEAD

Slide 73

Slide 73 text

Trial github.com/recruit-tech/git- bootcamp

Slide 74

Slide 74 text

SVN͔ΒGitʹӡ༻ม͍͑ͨΜ ͚ͩͲɻ

Slide 75

Slide 75 text

SVN͔ΒGitʹӡ༻ม͍͑ͨΜ ͚ͩͲɻ • SVN => தԝूݖܕ • Git => ෼ࢄܕ • Ұ൪͍͍ͷ͸Github͕ࠓ΍σϑΝΫτελϯμʔυͳͷ ͰɺͦΕҎ֎Ͱ΍ΔͳΒ߱ΓΔͧͬͯڴͯ͠΋ՄɻͦΕ Ͱฆڄͨ͠Β๻ΛݺΜͰ͍ͩ͘͞ɻ • see: http://qiita.com/YusukeHosonuma/items/ 14c59f3878d640a401a1

Slide 76

Slide 76 text

GitFlow͕͍͍ͷʁ GitHubFlow͕͍͍ͷʁ http://qiita.com/mint__/ items/ bfc58589b5b1e0a1856a

Slide 77

Slide 77 text

GitFlow͕͍͍ͷʁGitHubFlow ͕͍͍ͷʁ • ޷͖ͳ΋ͷΛ࢖͏ͱྑ͍ • ๻ͷ޷͖ͳͷ͸GithubFlowͷํɺmaster͕ ઈର҆ఆՔಇ͓ͤͯ͘͞΂͖ͱ͍͏໿ଋ͕क ΒΕ͍ͯΔͳΒͲͪΒͰ΋Մೳ

Slide 78

Slide 78 text

RepositoryͲͷ୯ҐͰΘ͚Δ ͷ͕͍͍ͷʁ

Slide 79

Slide 79 text

جຊతʹ͸Repository͸ϓϩ δΣΫτͰҰ͕ͭྑ͍ • ϚΠΫϩαʔϏε౳ͰϓϩδΣΫτ෼͚Δࣄ ΋ଟ͍͕ɺϦϙδτϦ͕෼͔ΕΔ㲈։ൃऀؒʹ ύʔςΟγϣϯΛઃ͚Δʹ౳͍͠ • ϓϩδΣΫτΛࣦഊͤ͞Δํ๏ɿhttp:// yosuke-furukawa.hatenablog.com/entry/ 2016/12/31/225913

Slide 80

Slide 80 text

git reflog

Slide 81

Slide 81 text

git reflog ࠷ѱϩʔΧϧ͕ফ͑ͨΓϒϥϯν͕ফ͑ͨΓͨ࣌͠ͷ࠷ऴखஈ $ git reset --hard HEAD^^ # HEAD^ͱࢦఆ͢Δͭ΋Γ͕ؒҧ͑ͨ! $ git reflog f5cb888 HEAD@{0}: head^^: updating HEAD 05b76fe HEAD@{1}: commit: 2.6.2 a546c2c HEAD@{2}: pull origin master: Fast-forward 843a591 HEAD@{3}: commit: rename package.json authors 6c66867 HEAD@{4}: pull origin master: Fast-forward 3e15c9e HEAD@{5}: checkout: moving from add_recruit_tech_problems to master 4af78a2 HEAD@{5}: commit: feat: add scope $ git reset --hard HEAD@{1} # reset hard લʹ໭ΕΔ

Slide 82

Slide 82 text

git bisect

Slide 83

Slide 83 text

git bisect Ͳ͔͜Β͔ɺੑೳ͕མͪͨɾςετ͕failʹͳͬͨ౳ͷ৔߹ͰͲ͜ͷίϛοτͰͦͷݱ৅͕ى ͖ͨͷ͔Λಛఆ͢ΔͨΊͷํ๏ɺೋ෼୳ࡧͰݕࡧͯ͘͠ΕΔ $ git bisect start HEAD v2.0 # v2.0Ͱ͸େৎ෉͚ͩͬͨͲHEADͰ͸໰୊͕͋Δ $ git bisect run <ςετίϚϯυ> # ͜ΕͰࣗಈతʹςετ͠ͳ͕Βfail/successͰίϛοτΛݟ͚ͭͯ͘ΕΔ $ git bisect good $ git bisect bad # खಈͰςετ͢ΔͳΒ͜ͷ΍Γํ͕͋Δ

Slide 84

Slide 84 text

͋Γ͕ͱ͏͍͟͝·ͨ͠