a git workflow
release management
^
(for when you can’t quite do
continuous deployment)
Slide 3
Slide 3 text
with thanks to Zach Holman...
http://zachholman.com/talk/how-github-uses-github-to-build-github
Slide 4
Slide 4 text
master
What We Really Want
Slide 5
Slide 5 text
master
ew/add-new-shiny
What We Really Want
Slide 6
Slide 6 text
master
ew/add-new-shiny
Slide 7
Slide 7 text
master
ew/add-new-shiny
PULL
REQUEST!
Slide 8
Slide 8 text
WHAT WE NEED
simple
prevent merge errors & regressions
consistency
keep everyone working on the latest
code as often as possible
Slide 9
Slide 9 text
LET’S TALK ABOUT
basic plan
feature branches
release branches
rebasing
bad habits
staging
releasing
Slide 10
Slide 10 text
START
A BASIC PLAN*
Slide 11
Slide 11 text
START
BRANCH
A BASIC PLAN*
Slide 12
Slide 12 text
START
PULL REQUEST
BRANCH
A BASIC PLAN*
Slide 13
Slide 13 text
START
PULL REQUEST
BRANCH
A BASIC PLAN*
Slide 14
Slide 14 text
START
PULL REQUEST
BRANCH
A BASIC PLAN*
Slide 15
Slide 15 text
CURRENT
release
branch
A BASIC PLAN*
pull
request
THE NEXT
release
branch
pull
request
Slide 16
Slide 16 text
USE:feature
branches
Slide 17
Slide 17 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 18
Slide 18 text
develop
Simple Example:
One shiny new feature
Slide 19
Slide 19 text
develop
ew/new-shiny
git checkout -b ew/new-shiny
Slide 20
Slide 20 text
develop
ew/new-shiny
git commit ...
Slide 21
Slide 21 text
develop
ew/new-shiny
Slide 22
Slide 22 text
develop
ew/new-shiny
Slide 23
Slide 23 text
NO!release
branches
Slide 24
Slide 24 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 25
Slide 25 text
develop
ew/new-shiny
Still Easy:
Two independent new features
jwl/moar
Slide 26
Slide 26 text
develop
jwl/moar
ew/new-shiny
Slide 27
Slide 27 text
develop
jwl/moar
ew/new-shiny
Slide 28
Slide 28 text
develop
jwl/moar
ew/new-shiny
Slide 29
Slide 29 text
develop
jwl/moar
ew/new-shiny
Slide 30
Slide 30 text
interlude on pull requests:
after the pull request, the branch is done
no more commits!
Slide 31
Slide 31 text
develop
jwl/moar
ew/new-shiny
Slide 32
Slide 32 text
develop
jwl/moar
ew/new-shiny
Slide 33
Slide 33 text
develop
jwl/moar
ew/new-shiny
Slide 34
Slide 34 text
develop
jwl/moar
ew/new-shiny
doesn’t have the
changes from
ew/new-shiny!
Slide 35
Slide 35 text
interlude on pull requests:
after the pull request, the branch is done
no more commits!
avoid confusion
delete the branch
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 38
Slide 38 text
REBASE
don’t
fear the
Slide 39
Slide 39 text
REBASE
stay on top of the latest changes
incorporate others’ work into
your own branch
don’t
fear the
Slide 40
Slide 40 text
develop
jwl/moar
ew/new-shiny
Small Problem:
@jwl needs @ew’s feature to finish
Slide 41
Slide 41 text
develop
jwl/moar
ew/new-shiny
REBASE!
git rebase origin/develop
on branch jwl/moar:
Slide 42
Slide 42 text
develop
jwl/moar
ew/new-shiny
REBASE!
git rebase origin/develop
on branch jwl/moar:
Slide 43
Slide 43 text
develop
jwl/moar
ew/new-shiny
Slide 44
Slide 44 text
develop
jwl/moar
ew/new-shiny
Slide 45
Slide 45 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 46
Slide 46 text
develop
Bigger Problem:
Big new feature needs two developers
Slide 47
Slide 47 text
develop
big-feature
git checkout -b big-feature
on branch develop:
develop
big-feature
jl/big-feature ew/big-feature
REBASE!
git rebase origin/big-feature
on branch ew/big-feature:
Slide 54
Slide 54 text
develop
big-feature
jl/big-feature
ew/big-feature
REBASE!
git rebase origin/big-feature
on branch 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
Slide 57
Slide 57 text
develop
big-feature
jl/big-feature
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
\o/ Feature is done!
Slide 60
Slide 60 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 61
Slide 61 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 62
Slide 62 text
STOP!with the
bad habits
Slide 63
Slide 63 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 64
Slide 64 text
No content
Slide 65
Slide 65 text
STAGE
all your
code’s a
Slide 66
Slide 66 text
STAGE
all your
code’s a
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 67
Slide 67 text
develop
jwl/moar
ew/new-shiny
git tag -f staging
git push -f origin staging
on branch jwl/moar:
staging
Slide 68
Slide 68 text
develop
jwl/moar
ew/new-shiny
REBASE!
git rebase origin/develop
on branch jwl/moar:
Slide 69
Slide 69 text
develop
jwl/moar
ew/new-shiny
git tag -f staging
git push -f origin staging
on branch jwl/moar:
staging
Slide 70
Slide 70 text
develop
jwl/moar
ew/new-shiny
git tag -f staging
on branch develop:
staging
Slide 71
Slide 71 text
PUSH IT!
release
management
Slide 72
Slide 72 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
ew/hotfix
master, develop
jl/new
git rebase origin/develop
on branch cs/hotness:
cs/hotness
v2.2.0
v2.1.1
v2.1.0
Slide 84
Slide 84 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