Slide 1

Slide 1 text

(JUϥΠϑΛ \ͪΐͬͱ ΋ͬͱ ௒^ շదʹ͢Δ ஌ΒΕ͟ΔίϚϯυͨͪ !VBTJ

Slide 2

Slide 2 text

VBTJ

Slide 3

Slide 3 text

w(JU)VC೥ੜ wͣͬͱ࢖ͬͯΔ wҰਓͰ࢖ͬͯΔ

Slide 4

Slide 4 text

ͣͬͱҰਓͰ࢖ͬͯΔ

Slide 5

Slide 5 text

$ git blame Document.h ca55733e (Tomoki Aonuma ... ad2d179e (Tomoki Aonuma ... 95074544 (Tomoki Aonuma ... c7bc39f9 (Tomoki Aonuma ... 95074544 (Tomoki Aonuma ... ca55733e (Tomoki Aonuma ... ^02e6c80 (Tomoki Aonuma ... a3a5d708 (Tomoki Aonuma ... fc79def1 (Tomoki Aonuma ...

Slide 6

Slide 6 text

νʔϜͷ͜ͱ͸ ෼͔Βͳ͍ʜ

Slide 7

Slide 7 text

ҰਓͰศརʹ ࢖͏ํ๏ ڭ͑·͢

Slide 8

Slide 8 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˑˑˑ ˒˒˒

Slide 9

Slide 9 text

git help

Slide 10

Slide 10 text

•ࠔͬͨΒHELP •Α͘࢖͏ίϚϯυ΄ͲΑ͘มΘΔ •git help -a ←ίϚϯυҰཡ •git help -g ←ΨΠυҰཡ git help

Slide 11

Slide 11 text

wgit help config wgit help glossary w༻ޠू wgit help revisions wHEAD^ͱ͔dev..masterͱ͔ git help

Slide 12

Slide 12 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒ˑˑ ˒˒ˑ

Slide 13

Slide 13 text

git status -sb

Slide 14

Slide 14 text

git status -sb git status \ --short \ --branch

Slide 15

Slide 15 text

git status $ git status # On branch master # Your branch is ahead of 'origin/mast # (use "git push" to publish your lo # # Untracked files: # (use "git add ..." to includ # # hoge nothing added to commit but untracked files present (use "git add" to track)

Slide 16

Slide 16 text

git status -sb $ git status -sb ## master...origin/master [ahead 1] ?? hoge

Slide 17

Slide 17 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒ˑˑ ˒˒ˑ

Slide 18

Slide 18 text

ls .git/hooks git help hooks

Slide 19

Slide 19 text

ls .git/hooks git help hooks •৭ʑͳλΠϛϯάͰ૸ΔϑοΫ •ίϛοτલޙ •Ϧϕʔεલ •νΣοΫΞ΢τޙ…

Slide 20

Slide 20 text

ls .git/hooks git help hooks •Kobito ͷ։ൃͰ͸ pre-commit ϑοΫͰ ιʔεϑΝΠϧ͕λʔήοτʹ ؚ·Ε͍ͯΔ͔νΣοΫ •gem ‘xcodeproj’

Slide 21

Slide 21 text

ls .git/hooks git help hooks •Kobito ͷ։ൃͰ͸ pre-commit ϑοΫͰ ιʔεϑΝΠϧ͕λʔήοτʹ ؚ·Ε͍ͯΔ͔νΣοΫ •gem ‘xcodeproj’

Slide 22

Slide 22 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒˒ˑ ˒˒ˑ

Slide 23

Slide 23 text

git diff \ --patience

Slide 24

Slide 24 text

git diff --patience •ʢͪΐͬͱʣݡ͍ diff •ࠩ෼͕ಡΈ΍͘͢ͳΔʢ͔΋ʣ

Slide 25

Slide 25 text

ྫ void foo() { printf("foo\n"); } void foo() { printf("foo\n"); printf("foo\n"); } void bar() { printf("bar\n"); } ฤूޙ ฤूલ

Slide 26

Slide 26 text

git diff $ git diff a.c b.c ... @@ -1,4 +1,9 @@ void foo() { printf("foo\n"); + printf("foo\n"); + +} +void bar() { + printf("bar\n"); }

Slide 27

Slide 27 text

git diff --patience $ git diff --patience a.c b.c ... @@ -1,4 +1,9 @@ void foo() { printf("foo\n"); + printf("foo\n"); } + +void bar() { + printf("bar\n"); +}

Slide 28

Slide 28 text

git diff --histogram •ʢ΋͏ͪΐͬͱʣݡ͍ diff •ࠩ෼͕ಡΈ΍͘͢ͳΔʢΑͶʁʣ

Slide 29

Slide 29 text

git config \ diff.algorithm •git config \ diff.algorithm \ (patience|histogram) •;ͭ͏ͷ diff Λ࢖͏ͱ͖͸ git diff \ --diff-algorithm=default

Slide 30

Slide 30 text

git config \ diff.algorithm •git log -U ΍ git format-patch ʹ΋Өڹ •࣮͸ͦΕΒͷίϚϯυʹ΋ --patience ͳͲΛࢦఆͰ͖Δ

Slide 31

Slide 31 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒˒˒ ˒˒ˑ

Slide 32

Slide 32 text

git diff git apply outside worktree ( )

Slide 33

Slide 33 text

git diff •Git ϦϙδτϦͷ֎Ͱ΋࢖͑Δ •;ͭ͏ͷ diff ΑΓศར •git diff --binary •git diff --color •git diff --word-diff

Slide 34

Slide 34 text

git diff •Git ϦϙδτϦͷதͰ ೚ҙͷ2ϑΝΠϧͷࠩ෼ΛऔΕΔ •git diff --no-index

Slide 35

Slide 35 text

git apply •Git ϦϙδτϦͷ֎Ͱ΋࢖͑Δ •git diff ͷύονΛ ౰ͯΔͱ͖ʹ •git diff old new >patch git apply patch # old ͕ ফ͑Δʂ #(∵old+มߋ+վ໊==new)

Slide 36

Slide 36 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒˒˒ ˒ˑˑ

Slide 37

Slide 37 text

pushInsteadOf

Slide 38

Slide 38 text

pushInsteadOf ͳ͠ # HTTPS URL ͰΫϩʔϯ $ git clone https://github.com/foo/bar # ... # ॻ͖ࠐΈݖݶΛ΋Βͬͨʂ $ git push origin master Username for 'https://github.com': # ໘౗ʂ

Slide 39

Slide 39 text

pushInsteadOf $ cat ~/.gitconfig ... [url "[email protected]:"] " pushinsteadof = "git://github.com/" " pushinsteadof = "https://github.com/"

Slide 40

Slide 40 text

pushInsteadOf ͋Γ # HTTPS URL ͰΫϩʔϯ $ git clone https://github.com/foo/bar # ... # ॻ͖ࠐΈݖݶΛ΋Βͬͨʂ $ git push origin master Total 0 (delta 0), reused 0 (delta 0) To [email protected]:foo/bar ...

Slide 41

Slide 41 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒˒˒ ˒˒ˑ

Slide 42

Slide 42 text

git new-workdir

Slide 43

Slide 43 text

•ϦϙδτϦͷ࡞ۀσΟϨΫτϦΛ ৽ͨʹ࡞Δ •git new-workdir \ \ \ [] git new-workdir

Slide 44

Slide 44 text

•contrib σΟϨΫτϦʹ͋Δ •/usr/local/share/git- core/contrib/workdir ͋ͨΓ git new-workdir

Slide 45

Slide 45 text

஌ΒΕ͟Δ౓ ໾ཱͪ౓ ˒˒˒ ˒˒˒

Slide 46

Slide 46 text

git rebase -i \ --autosquash

Slide 47

Slide 47 text

--autosquash •ίϛοτϝοηʔδ͕ fixup! ͔ squash! Ͱ ࢝·ΔίϛοτΛࣗಈతʹ fixup/squash •fixup! ͷޙʹର৅ͷίϛοτͷ ϝοηʔδΛࢦఆʢ਺จࣈͰOKʣ

Slide 48

Slide 48 text

--autosquash $ git log oneline a99e5d7 fixup! X d2cb153 fixup! A c85fc65 Add Foo $ git rebase -i --autosquash c85fc65^ pick c85fc65 Add Foo fixup d2cb153 fixup! A pick a99e5d7 fixup! X

Slide 49

Slide 49 text

rebase.autosquash $ git config [--global] \ rebase.autosquash true ͍ͭͰ΋ autosquash

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

஌Βͳ͍ίϚϯυ͸ ͋Γ·͔ͨ͠ʁ

Slide 52

Slide 52 text

(JUʹ͸·ͩ·ͩ ίϚϯυ΍Φϓγϣϯ͕ ௥Ճ͞Ε͍ͯ·͢ ʢϦϦʔεϊʔτΛνΣοΫʂʣ

Slide 53

Slide 53 text

໘ന͍ίϚϯυΛ ݟ͚ͭͨΒ 2JJUBͰγΣΞʂ ʢએ఻Ͱ͢ʣ

Slide 54

Slide 54 text

&OKPZ