Real world Git workflows · Real world Git workflows. TODO Show of hands ! Picture with...
Transcript of Real world Git workflows · Real world Git workflows. TODO Show of hands ! Picture with...
Cheap local branchingFull local history
Speed
Staging area
prominent in Open Source
Huge community
You heard has
Superior Merging
Much faster than svn
Distributedcryptographic integrity
Fully decentralized Anarchy
I do my thingI do my thing, too
ANARCHYhere’s mine, who tells
john?look ma, a goat!
upcoming Release ?
Can we still fix a bug for the
FeatureIs the code for that
complete?
for the current version?HotfixHow do we do a
upcoming Release ?
Can we still fix a bug for the
FeatureIs the code for that
complete?
for the current version?HotfixHow do we do a
ReviewedHas everyone
the code for this feature ?
+ different teams+ different products
different cultures
= different workflows
Git workflow?What’s the best
Working on features in parallel
master
Feature #1
Feature #2 m
m m
•Always with local branches•With shared branches: After review, before merging
Working on features in parallel
master
Feature #1
Feature #2 m
m m
•Always with local branches•With shared branches: After review, before merging•Mostly a non-issue for short lived branches when updates from master are not required
master is in production1
staging is the next version
new features off staging
2
3
promoted from staging, can receive hot-fixes
master is in production1
staging is the next version
new features off staging
2
3
with branch names like: username/ISSUE-KEY-summary
promoted from staging, can receive hot-fixes
staging
master
feature-2
3. Continuous delivery workflow
m
feature-1
mm
R H
release to production = merge master
In Production
m
staging
master
feature-2
3. Continuous delivery workflow
m
feature-1
mm
R H
only merges
release to production = merge master
In Production
m
one branch per feature1
one branch per bugfix
long running stable branches
2
3
master is alpha/RC status4
2.2
2.1
Bugfix
Automatically merging release branches
2.1.5-SNAPSHOT2.1.4
We don’t want to merge the 2.1.x version!
2.2
2.1
Bugfix
Automatically merging release branches
2.1.5-SNAPSHOT2.1.4
$> git checkout stable-2.2$> git merge -s ours stable-2.1
2.2
2.1
Bugfix
Automatically merging release branches
merge commit, content discarded
$> git checkout stable-2.2$> git merge -s ours stable-2.1
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline
Release branch
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually
Release branch
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Release branch
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Less stable than its baseline
Release branch
Release branch
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Less stable than its baseline
Release branch
Release branch
Feature branches
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Less stable than its baseline When code complete
Release branch
Release branch
Feature branches
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Less stable than its baseline When code complete Continually
Release branch
Release branch
Feature branches
The merge protocolThe secret sauce
When a branch is: Change flows from branch to baseline:
Change flows from baseline to branch:
More stable than its baseline Continually Never
Less stable than its baseline When code complete Continually
Release branch
Release branch
Feature branchesCredit: Laura Wingerd - The Flow of change
The merge protocolThe secret sauce
Release branch
Release Branch
Master
http://bit.ly/branch-based-workflows
The merge protocolThe secret sauce
Release branch
Release Branch
Master
Merge continually
http://bit.ly/branch-based-workflows
The merge protocolThe secret sauce
Release branch
Release Branch
Master
Merge continually
Never merge!
http://bit.ly/branch-based-workflows
The merge protocolThe secret sauce
Release branch
Release Branch
Master
Merge continually
Backport single changes using git cherry-pick
Never merge!
http://bit.ly/branch-based-workflows
http://bit.ly/branch-based-workflows
The merge protocolThe secret sauce
!!!
Branching Model
Adopt Git Practices
!!!!!
Productworkflow
Continuousdeliveryworkflow
!!!
Collaboration Model
Centralized
!!!
Branching Model
Adopt Git Practices
!!!!!
Productworkflow
Continuousdeliveryworkflow
!!!
Collaboration Model
Centralized
Mergeprotocol
!!!
Branching Model
Adopt Git Practices
!!!!!
Productworkflow
Continuousdeliveryworkflow
Buildautomatically,
but leaveknobs!
!!!
Collaboration Model
Centralized
Mergeprotocol
!!!
Branching Model
Adopt Git Practices
!!!!!
Productworkflow
Continuousdeliveryworkflow
Embrace PR
Buildautomatically,
but leaveknobs!
!!!
Collaboration Model
Centralized
Mergeprotocol
!!Thank you for your !attention! !!!!
@stefansaasen !!
www.atlassian.com
http://www.flickr.com/photos/45143319@N00/3888895871/
http://www.flickr.com/photos/40145521@N00/460270581/
http://www.flickr.com/photos/41864721@N00/4647696349
http://www.flickr.com/photos48889052497@N01/12613483263/
http://www.flickr.com/photos/30928442@N08/4766664095/
http://www.flickr.com/photos/marfis75/3272079115/
Credits