Slide 1

Slide 1 text

Deliberate Git Stephen Ball

Slide 2

Slide 2 text

Git

Slide 3

Slide 3 text

Git Commits

Slide 4

Slide 4 text

Git Commits == Super Email

Slide 5

Slide 5 text

Git Commits == Super Email Last forever

Slide 6

Slide 6 text

Git Commits == Super Email Last forever Are extremely searchable

Slide 7

Slide 7 text

Git Commits == Super Email Last forever Are extremely searchable Are available to everyone

Slide 8

Slide 8 text

“1.21 gigawatts”

Slide 9

Slide 9 text

“1.21 gigawatts!?!!”

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Noooo -___-

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

“Forgot to update form action for new lead engine”

Slide 15

Slide 15 text

“Forgot to update form action for new lead engine” “Switched to new lead engine”

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Replace lead tracking Foo with Bar Foo’s API has dropped 5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).

Slide 18

Slide 18 text

Replace lead tracking Foo with Bar Foo’s API has dropped 5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).

Slide 19

Slide 19 text

Replace lead tracking Foo with Bar Foo’s API has dropped 5 out of the last 27 leads since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).

Slide 20

Slide 20 text

Replace lead tracking Foo with Bar Foo’s API has dropped 5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).

Slide 21

Slide 21 text

Good Commit Subjects

Slide 22

Slide 22 text

Good Commit Subjects Written in the present tense

Slide 23

Slide 23 text

Good Commit Subjects Written in the present tense Written as commands

Slide 24

Slide 24 text

Good Commit Bodies

Slide 25

Slide 25 text

Good Commit Bodies Can be informal

Slide 26

Slide 26 text

Good Commit Bodies Can be informal Describe the “why?”

Slide 27

Slide 27 text

Good Commit Bodies Can be informal Describe the “why?” Messages to your team

Slide 28

Slide 28 text

Commits Should Tell Us

Slide 29

Slide 29 text

Commits Should Tell Us What the change does

Slide 30

Slide 30 text

Commits Should Tell Us What the change does Why it's necessary

Slide 31

Slide 31 text

Commits Might Tell Us

Slide 32

Slide 32 text

Commits Might Tell Us Alternatives considered

Slide 33

Slide 33 text

Commits Might Tell Us Alternatives considered Potential consequences

Slide 34

Slide 34 text

Are Git Commits like Comments?

Slide 35

Slide 35 text

Are Git Commits like Comments? # set x to 5 y = 3

Slide 36

Slide 36 text

Git Commits are always in sync Commits are tied to the change They’re comments that expire (automatically)

Slide 37

Slide 37 text

Can we keep coding flow?

Slide 38

Slide 38 text

Can we keep coding flow? WIP commits while coding

Slide 39

Slide 39 text

Can we keep coding flow? WIP commits while coding Commit frequently

Slide 40

Slide 40 text

Can we keep coding flow? WIP commits while coding Commit frequently Rewrite your commits

Slide 41

Slide 41 text

Code, Commit, Rewrite Code Commit Rewrite

Slide 42

Slide 42 text

Git Rebase

Slide 43

Slide 43 text

git rebase -i

Slide 44

Slide 44 text

git rebase -i Rewrite commits Remove commits Combine commits Reorder commits

Slide 45

Slide 45 text

$ git rev-list master..feature | wc -l 37

Slide 46

Slide 46 text

$ git rev-list master..feature | wc -l 37 $ git rebase -i 1123e81 [magic happens] (ů◕‿◕)ů*:ŋƅ✧

Slide 47

Slide 47 text

$ git rev-list master..feature | wc -l 37 $ git rebase -i 1123e81 [magic happens] (ů◕‿◕)ů*:ŋƅ✧ $ git rev-list master..feature | wc -l 5

Slide 48

Slide 48 text

Using “git rebase -i” Use “git log” to find the commit before the first commit you want to change. “git rebase -i [that commit’s hash] Magic time!

Slide 49

Slide 49 text

$ git l * 193bn13 WIP switch fizz to bazz * 6a0b73a WIP support fizz * aa02d1e WIP Start to hack out foo * 3a049ba Allow creating users via JSON $ git rebase -i 3a049ba

Slide 50

Slide 50 text

pick aa02d1e WIP Start to hack out foo pick 6a0b73a WIP support fizz pick 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.

Slide 51

Slide 51 text

pick aa02d1e WIP Start to hack out foo pick 6a0b73a WIP support fizz pick 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.

Slide 52

Slide 52 text

reword aa02d1e WIP Start to hack out foo fixup 6a0b73a WIP support fizz fixup 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.

Slide 53

Slide 53 text

Add foo feature with bazz support The ability to foo has been requested by various users. This implementation will allow foo with support for the bazz protocol. At first we thought that the fizz protocol would be a good fit, but that wasn’t the case when we tested it against over 10,000 interactions. We opened up an issue with the fizz API. - The bazz protocol: http://example.com/bazz - fizz api failure issue: http://example.com/issue/12

Slide 54

Slide 54 text

Digging into History

Slide 55

Slide 55 text

Git History Commands git log git log -p git log --grep=”commit contents” git log -S”diff contents” git log -- path/or/file git blame FILENAME

Slide 56

Slide 56 text

Let’s wrap this up

Slide 57

Slide 57 text

Thank you! Stephen Ball @stephenballnc http://rakeroutes.com