Slide 1

Slide 1 text

a sane git workflow

Slide 2

Slide 2 text

a sane git workflow (for the fairly advanced git user who can’t quite use github’s awesome continuous deployment methodology because they still have to deal with versions and releases and other business / marketing nonsense)

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

PROCESS PROCESS PROCESS P OCESS PROCESS PROCESS PROC PROCESS PROCESS PROCESS PR

Slide 5

Slide 5 text

PROCESS PROCESS PROCESS P OCESS PROCESS PROCESS PROC PROCESS PROCESS PROCESS PR Do I need to merge twice? How do I resolve this conflict? Where do I merge?

Slide 6

Slide 6 text

PROCESS PROCESS PROCESS P OCESS PROCESS PROCESS PROC PROCESS PROCESS PROCESS PR WTF is going on? Do I need to merge twice? How do I resolve this conflict? Where do I merge?

Slide 7

Slide 7 text

develop What We Really Want

Slide 8

Slide 8 text

develop ew/add-new-shiny What We Really Want

Slide 9

Slide 9 text

develop ew/add-new-shiny

Slide 10

Slide 10 text

develop ew/add-new-shiny PULL REQUEST!

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

IT’S JUST NOT THIS HARD!

Slide 13

Slide 13 text

WHAT WE NEED simple prevent merge errors & regressions consistency keep everyone working on the latest code as often as possible

Slide 14

Slide 14 text

LET’S TALK ABOUT a fresh start feature branches release branches rebasing bad habits staging releasing

Slide 15

Slide 15 text

START PULL REQUEST BRANCH

Slide 16

Slide 16 text

START SANE, STAY SANE master == develop If it doesn’t, figure out why not! Unmerged features? Probably need to break these out. If all else fails, rename develop to something else and start clean

Slide 17

Slide 17 text

git fetch git checkout origin/develop git checkout -b old-develop git push origin old-develop git checkout develop git reset --hard origin/master git push -f origin develop

Slide 18

Slide 18 text

master, develop

Slide 19

Slide 19 text

USE:feature branches

Slide 20

Slide 20 text

USE:feature branches branch from develop when you start a new feature rebase onto develop often stay up to date with the latest and greatest pull request into develop when done

Slide 21

Slide 21 text

develop Simple Example: One shiny new feature

Slide 22

Slide 22 text

develop ew/new-shiny git checkout -b ew/new-shiny

Slide 23

Slide 23 text

develop ew/new-shiny git commit ...

Slide 24

Slide 24 text

develop ew/new-shiny

Slide 25

Slide 25 text

develop ew/new-shiny

Slide 26

Slide 26 text

NO!release branches

Slide 27

Slide 27 text

NO!release branches develop is your release branch nothing merges into develop until it is ready to release you can’t release until everything in develop is ready new features branch from, and merge back into, develop

Slide 28

Slide 28 text

develop ew/new-shiny Still Easy: Two independent new features kb/moar

Slide 29

Slide 29 text

develop kb/moar ew/new-shiny

Slide 30

Slide 30 text

develop kb/moar ew/new-shiny

Slide 31

Slide 31 text

develop kb/moar ew/new-shiny

Slide 32

Slide 32 text

develop kb/moar ew/new-shiny

Slide 33

Slide 33 text

interlude on pull requests: after the pull request, the branch is done no more commits!

Slide 34

Slide 34 text

develop kb/moar ew/new-shiny

Slide 35

Slide 35 text

develop kb/moar ew/new-shiny

Slide 36

Slide 36 text

develop kb/moar ew/new-shiny

Slide 37

Slide 37 text

develop kb/moar ew/new-shiny doesn’t have the changes from ew/new-shiny!

Slide 38

Slide 38 text

interlude on pull requests: after the pull request, the branch is done no more commits! avoid confusion delete the branch

Slide 39

Slide 39 text

develop kb/moar-cont ew/new-shiny git branch -d kb/moar git checkout -b kb/moar-cont on branch develop:

Slide 40

Slide 40 text

interlude on pull requests: after the pull request, the branch is done no more commits! avoid confusion delete the branch, or fast-forward to the merged branch

Slide 41

Slide 41 text

REBASE don’t fear the

Slide 42

Slide 42 text

REBASE stay on top of the latest changes incorporate others’ work into your own branch don’t fear the

Slide 43

Slide 43 text

develop kb/moar ew/new-shiny Small Problem: @kb needs @ew’s feature to finish

Slide 44

Slide 44 text

develop kb/moar ew/new-shiny REBASE! git rebase origin/develop on branch kb/moar:

Slide 45

Slide 45 text

develop kb/moar ew/new-shiny REBASE! git rebase origin/develop on branch kb/moar:

Slide 46

Slide 46 text

develop kb/moar ew/new-shiny

Slide 47

Slide 47 text

develop kb/moar ew/new-shiny

Slide 48

Slide 48 text

REBASE fear not the stay on top of the latest changes incorporate others’ work into your own branch two developers working on the same feature branch may depend on each other’s progress abstract one more level

Slide 49

Slide 49 text

develop Bigger Problem: Big new feature needs two developers

Slide 50

Slide 50 text

develop big-feature git checkout -b big-feature on branch develop:

Slide 51

Slide 51 text

develop big-feature jl/big-feature ew/big-feature git checkout -b jl/big-feature git checkout -b ew/big-feature on branch big-feature:

Slide 52

Slide 52 text

develop big-feature jl/big-feature ew/big-feature

Slide 53

Slide 53 text

develop big-feature jl/big-feature ew/big-feature PULL REQUEST!

Slide 54

Slide 54 text

develop big-feature jl/big-feature ew/big-feature

Slide 55

Slide 55 text

develop big-feature jl/big-feature ew/big-feature

Slide 56

Slide 56 text

develop big-feature jl/big-feature ew/big-feature REBASE! git rebase origin/big-feature on branch ew/big-feature:

Slide 57

Slide 57 text

develop big-feature jl/big-feature ew/big-feature REBASE! git rebase origin/big-feature on branch ew/big-feature:

Slide 58

Slide 58 text

develop big-feature jl/big-feature ew/big-feature

Slide 59

Slide 59 text

develop big-feature jl/big-feature ew/big-feature

Slide 60

Slide 60 text

develop big-feature jl/big-feature ew/big-feature

Slide 61

Slide 61 text

develop big-feature jl/big-feature ew/big-feature

Slide 62

Slide 62 text

develop big-feature jl/big-feature ew/big-feature \o/ Feature is done!

Slide 63

Slide 63 text

things to note: no shared branches rebase at will fewer pull/merge conflicts merge code when it won’t break others’ your branch back to feature branch feature branch back to develop all merging done by github code reviews! if github can’t merge, rebase! less likely to resolve conflicts incorrectly

Slide 64

Slide 64 text

things to note: • no shared branches • rebase at will • fewer pull/merge conflicts • merge code when it won’t break others’ • your branch back to feature branch • feature branch back to develop • all merging done by github • code reviews! • if github can’t merge, rebase! less likely to resolve conflicts incorrectly!!

Slide 65

Slide 65 text

STOP!with the bad habits

Slide 66

Slide 66 text

STOP!with the bad habits the straight line myth is dead you’ll have lots of branches merges are not evil use GUIs sparingly this is code, not a pretty picture git pull is evil git fetch, followed by git merge

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

NO!staging branch

Slide 69

Slide 69 text

NO!staging branch staging is a tag any developer can tag staging and deploy their code there final qa before release? merge features into develop and tag staging there

Slide 70

Slide 70 text

develop kb/moar ew/new-shiny git tag -f staging git push -f origin staging on branch kb/moar: staging

Slide 71

Slide 71 text

develop kb/moar ew/new-shiny REBASE! git rebase origin/develop on branch kb/moar:

Slide 72

Slide 72 text

develop kb/moar ew/new-shiny git tag -f staging git push -f origin staging on branch kb/moar: staging

Slide 73

Slide 73 text

develop kb/moar ew/new-shiny git tag -f staging on branch develop: staging

Slide 74

Slide 74 text

PUSH IT! release management

Slide 75

Slide 75 text

PUSH IT! release management hotfixes on master pull request from develop to master fast-forward develop to master (branches end after merge) tag your release v2.1.5

Slide 76

Slide 76 text

develop, master v2.1.0

Slide 77

Slide 77 text

ew/hotfix develop master v2.1.1 v2.1.0

Slide 78

Slide 78 text

ew/hotfix jl/new master kb/hotness develop v2.1.1 v2.1.0

Slide 79

Slide 79 text

ew/hotfix develop master jl/new kb/hotness v2.1.1 v2.1.0

Slide 80

Slide 80 text

ew/hotfix develop master jl/new git rebase origin/master git tag -f staging on branch develop: staging kb/hotness v2.1.1 v2.1.0

Slide 81

Slide 81 text

ew/hotfix develop master jl/new kb/hotness v2.2.0 v2.1.1 v2.1.0

Slide 82

Slide 82 text

ew/hotfix master, develop jl/new git branch -d develop git checkout -b develop on branch master: kb/hotness v2.2.0 v2.1.1 v2.1.0

Slide 83

Slide 83 text

ew/hotfix master, develop jl/new kb/hotness v2.2.0 v2.1.1 v2.1.0

Slide 84

Slide 84 text

ew/hotfix master, develop jl/new git rebase origin/develop on branch kb/hotness: kb/hotness v2.2.0 v2.1.1 v2.1.0

Slide 85

Slide 85 text

REVIEW master == develop feature branches from develop don’t share branches! pull request back to develop rebase to stay current hotfix branches from master pull request back to master branches end after merge