SlideShare ist ein Scribd-Unternehmen logo
1 von 69
Downloaden Sie, um offline zu lesen
Workflows á-la-carte
Nicola Paolucci

Developer Advocate / Git Evangelist

I come out nice in pictures, I know :-).

durdn.com

@durdn
You heard

has
Cheap local branching

Full local history

10x the speed of svn

Staging area
Speed

Huge community
Feature based workflow

prominent in Open Source
cryptographic integrity

Distributed
ground breaking paradigm
is ground breaking
Workflow building blocks
fork

cheap branching

rebase
powerful merging
distributed
clone
Can we do a fast
Can we fix a bug for the
upcoming

RELEASE

HOTFIXrelease?
for the current

?
Can we

BUILD

the current code ?
Is the code for that

FEATURE
complete?

Has everybody

REVIEWED ?
the code for this feature
What we’ll cover:
1

Branching models

2

Practices & Decisions

3

Tooling & Automation

4

Continuous Integration
1

Which branching model?
Two common Branching Models
1

Continuous Delivery

2

Product Releases
1.1

for Continuous Delivery
staging

promoted from staging, can receive hotfixes

Time

feature

master/
production

master is in production
PR

staging is the next version
new features off staging
with branch names like:

Hotfix

username/ISSUE-KEY-summary
1.2

for Product Releases
PRJ-123-description
PRJ-123-bug-description

Time

feature
bugfix
branches
branch

master

1

One Central Repository

2

One Branch per Feature

3

One Branch per Bugfix
master

Long running

2.2

PRJ-345-bug-description

Time

bugfix

release
branch

4

Release Branches

5

master is alpha / RC
Automatic merges for the win!
Automatic MERGES!

release
branch

release
branch

2.1

2.2

PRJ-345-bug-description

Time

bugfix

master
Placeholder for changes you DON’T want to merge!
release
branch

release
branch

2.1

2.2

2.2.1

2.1.4
2.1.5-SNAPSHOT

What can we do here?

We don’t want to merge
the 2.1.x version!
git merge --strategy= ours
stable
branch

stable
branch

2.1

2.2

2.2.1

2.1.4
2.1.5-SNAPSHOT

$> git checkout stable-2.2	
$> git merge -s ours stable-2.1

merge commit, content
discarded
Deep breath, it’s really simple
The secret sauce

The merge protocol
The secret sauce

The merge protocol
When a branch is:

Change flows from 

branch to baseline:

Change flows from baseline
to branch:

More stable than its baseline

Continuously

Never

When code complete

Continuously

Release branch

Less stable than its baseline
Feature branches

Credit: Laura Wingerd - The Flow of change
The secret sauce

The merge protocol
Release Branch
Never

Merge

merge!

continuously

Master

Backport single
changes using
git cherry-pick
turbo boost!

2

Practices & Decisions
What is a Pull Request?
Pull Request
I have some
code here!

Hey I have some code I
want to merge here,
take a look?

Low friction
collaboration

Can I merge
it here?
Merge vs Rebase
Does a debate even exist?

REBASE

MERGE
What is a Rebase?
Merge commit
feature

master

feature

master
Merge as team policy
with no fast-forwards

1

Traceability

2

At a cost: readability

3

bisect debugging is harder
Rebase as team policy [1]
1

History flat and clean

2

Delicate with Pull Requests

3

Dangerous for unexperienced
Rebase as team policy [2]
4

Re-resolve similar conflicts

5

Requires often a force push

6

Loses context for feature
Rebase as a local cleanup
git rebase --interactive
1

Do it

2

Do it

3

Do it!!!!!!
Recommendation?
1

If team unfamiliar, don’t rebase

2

Encourage rebase as cleanup

and proper ecology
Recommendation?
Explicit merges into the mainline

3

Don’t fear the Merge! Use it!

git log --first-parent

After review!

4

May rebase feature branches

To update the feature branch

5

Work with the tool!
Trying to strive for a linearized history is less useful than you think
Single Repository
vs
Remote Forks
With Forks
Every one has their
remote repository

Full remote copy,
each has one

Integrator, Gatekeeper,
Tech Lead, etc.
Pros of a Single Repo
All feature
branches
available

1

Complete visibility

2

No per Dev remotes required

3

KISS
Forks
Are Great too BTW
FORKING
IN THE

ENTERPRISE
FORKING IN

5 Reasons for...

ENTERPRISE

REASON 1

Great for customizing libraries
and still get bug fixes
FORKING IN

ENTERPRISE

REASON 2

Great for innovation spikes
and maybe add it later
FORKING IN

but still be open for changes

REASON 3

Protecting your components

ENTERPRISE
FORKING IN

ENTERPRISE

REASON 4

Reduce the noise
and keep the overview for huge projects
FORKING IN

ENTERPRISE

REASON 5

Interaction with Contractors &
Interns
protect your sources
3

Tooling & Automation
Hooks
“

Hooks are little scripts you can place in
the `$GIT_DIR/hooks` directory to trigger
action at certain points.

– githooks Documentation

”
Pre

Post
Local

Remote
Local
pre-/post-applypatch
pre-/post-commit

Remote
pre-receive
update

pre-rebase

post-receive

post-checkout

post-update

post-merge
pre-push
Code Quality
via pre-commit hooks
.git/hooks/pre-commit!
git add -u!
git commit -m "TEST checkstyle"!
Starting audit...!
!

/Users/user/[...]/com/atlassian/stash/
web/projects/ProjectController.java:
161:12: 'for' is not followed by
whitespace.!
!

Audit done.!
Commit aborted.
Branch from green builds
.git/hooks/post-checkout
$ git checkout master!
master is lookin'good! !
c4f3b4b has 4 green builds.!
 !
$ git checkout stable-2.3 !
DANGER! stable-2.3 is
busted. e1324fa has 2 red
builds.!
Get it at:
bitly.com/green-builds
4

What happens to CI with

?
1

What happens to CI with git?

2

An explosion of branches

3

Performance degradation of build sys
1

Building everything is expensive

2

Automatically build stable and master

3

Manually trigger feature branch builds
In Conclusion: the recipe
Conclusions
Collaboration
Model

Branching
Model
Product

!
Centralized
!
!

workflow
!
!
!
Continuous
delivery
workflow

Practices &
Decisions

Embrace PR

!
!
Merge vs
!
!
Rebase
!
Single Repo
or Forks

Automation &
CI setup
Hooks, hooks
everywhere
!
!
!
Build
!
automatically,
!
but leave
knobs!
Nicola Paolucci

THANK YOU FOR YOUR ATTENTION!

Should I change the pic? ;-)

durdn.com

@durdn
http://strawpoll.me/774809
Atlassian
Git Repository Management
for Enterprise Teams
Free Git Code Hosting
for Small Teams
Free Git Desktop client
for Mac or Windows

Weitere ähnliche Inhalte

Was ist angesagt?

40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
Ruben Tan
 

Was ist angesagt? (20)

DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...
DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...
DevOpsDaysRiga 2018: Neil Crawford - Trunk based development, continuous depl...
 
How do you implement Continuous Delivery? Part 2: Code Management
How do you implement Continuous Delivery? Part 2: Code ManagementHow do you implement Continuous Delivery? Part 2: Code Management
How do you implement Continuous Delivery? Part 2: Code Management
 
How we git - commit policy and code review
How we git - commit policy and code reviewHow we git - commit policy and code review
How we git - commit policy and code review
 
Porque Odeio Branches
Porque Odeio BranchesPorque Odeio Branches
Porque Odeio Branches
 
Is Trunk-based Development Easy in Game Development?
Is Trunk-based Development Easy in Game Development?Is Trunk-based Development Easy in Game Development?
Is Trunk-based Development Easy in Game Development?
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
 
Git workflow step by step
Git workflow step by stepGit workflow step by step
Git workflow step by step
 
End-to-end performance testing, profiling, and analysis at Redis
End-to-end performance testing, profiling, and analysis at RedisEnd-to-end performance testing, profiling, and analysis at Redis
End-to-end performance testing, profiling, and analysis at Redis
 
Effective Code Review (Or How To Alienate Your Coworkers)
Effective Code Review (Or How To Alienate Your Coworkers)Effective Code Review (Or How To Alienate Your Coworkers)
Effective Code Review (Or How To Alienate Your Coworkers)
 
Git Branching for Agile Teams
Git Branching for Agile TeamsGit Branching for Agile Teams
Git Branching for Agile Teams
 
Branching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development ProcessBranching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development Process
 
DevTalk: From Uni to Enterprise
DevTalk: From Uni to EnterpriseDevTalk: From Uni to Enterprise
DevTalk: From Uni to Enterprise
 
Continuous delivery from the trenches
Continuous delivery from the trenchesContinuous delivery from the trenches
Continuous delivery from the trenches
 
DevOps - Its just Agile done right
DevOps - Its just Agile done rightDevOps - Its just Agile done right
DevOps - Its just Agile done right
 
Perfecting Your Development Tools: Updates to the Helix Plugin for Jenkins
Perfecting Your Development Tools: Updates to the Helix Plugin for JenkinsPerfecting Your Development Tools: Updates to the Helix Plugin for Jenkins
Perfecting Your Development Tools: Updates to the Helix Plugin for Jenkins
 
Git and Git Workflow Models as Catalysts of Software Development
Git and Git Workflow Models as Catalysts of Software DevelopmentGit and Git Workflow Models as Catalysts of Software Development
Git and Git Workflow Models as Catalysts of Software Development
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams
 
OpenSlava 2015 When DevOps Hurts
OpenSlava 2015 When DevOps HurtsOpenSlava 2015 When DevOps Hurts
OpenSlava 2015 When DevOps Hurts
 

Ähnlich wie Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Paolucci

JAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git WorkflowsJAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git Workflows
jazoon13
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
Nowell Strite
 

Ähnlich wie Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Paolucci (20)

Be a Happier Developer with Git / Productive Team #gettinggitright
Be a Happier Developer with Git / Productive Team #gettinggitright Be a Happier Developer with Git / Productive Team #gettinggitright
Be a Happier Developer with Git / Productive Team #gettinggitright
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Infrastructure as Code for Network
Infrastructure as Code for NetworkInfrastructure as Code for Network
Infrastructure as Code for Network
 
JAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git WorkflowsJAZOON'13 - Stefan Saasen - Real World Git Workflows
JAZOON'13 - Stefan Saasen - Real World Git Workflows
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015Dev Ops for systems of record - Talk at Agile Australia 2015
Dev Ops for systems of record - Talk at Agile Australia 2015
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Source Code Management Slides
Source Code Management SlidesSource Code Management Slides
Source Code Management Slides
 
Ultimate Git Workflow - Seoul 2015
Ultimate Git Workflow - Seoul 2015Ultimate Git Workflow - Seoul 2015
Ultimate Git Workflow - Seoul 2015
 
Challenges and best practices of database continuous delivery
Challenges and best practices of database continuous deliveryChallenges and best practices of database continuous delivery
Challenges and best practices of database continuous delivery
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
 
10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs
 
Make Your Team Flow
Make Your Team FlowMake Your Team Flow
Make Your Team Flow
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps Jumpstart
 
Adrian marinica continuous integration in the visual studio world
Adrian marinica   continuous integration in the visual studio worldAdrian marinica   continuous integration in the visual studio world
Adrian marinica continuous integration in the visual studio world
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 
Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
 
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
 
An intro to git
An intro to gitAn intro to git
An intro to git
 

Mehr von hamidsamadi (7)

"Real-time data processing with Spark & Cassandra", jDays 2015 Speaker: "Duy-...
"Real-time data processing with Spark & Cassandra", jDays 2015 Speaker: "Duy-..."Real-time data processing with Spark & Cassandra", jDays 2015 Speaker: "Duy-...
"Real-time data processing with Spark & Cassandra", jDays 2015 Speaker: "Duy-...
 
"Getting familiar with Spring Boot", jDays 2015 Speaker: "Mattias Severson"
"Getting familiar with Spring Boot", jDays 2015 Speaker: "Mattias Severson" "Getting familiar with Spring Boot", jDays 2015 Speaker: "Mattias Severson"
"Getting familiar with Spring Boot", jDays 2015 Speaker: "Mattias Severson"
 
HTTP 2.0 & Java: Current Status", Part 1, jDays 2015 Speaker: "Simone Bordet
HTTP 2.0 & Java: Current Status", Part 1, jDays 2015 Speaker: "Simone BordetHTTP 2.0 & Java: Current Status", Part 1, jDays 2015 Speaker: "Simone Bordet
HTTP 2.0 & Java: Current Status", Part 1, jDays 2015 Speaker: "Simone Bordet
 
"Analytics inside your Java application", Part 2, jDays 2015 Speaker: "Veaces...
"Analytics inside your Java application", Part 2, jDays 2015 Speaker: "Veaces..."Analytics inside your Java application", Part 2, jDays 2015 Speaker: "Veaces...
"Analytics inside your Java application", Part 2, jDays 2015 Speaker: "Veaces...
 
JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...
JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...
JCache is here. Say goodbye to proprietary Caching API's", jDays 2015 Speaker...
 
Facebook Graph Search by Ole martin mørk for jdays2013 Gothenburg www.jdays.se
Facebook Graph Search by Ole martin mørk for jdays2013 Gothenburg www.jdays.seFacebook Graph Search by Ole martin mørk for jdays2013 Gothenburg www.jdays.se
Facebook Graph Search by Ole martin mørk for jdays2013 Gothenburg www.jdays.se
 
Java overview 20131022
Java overview 20131022Java overview 20131022
Java overview 20131022
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Paolucci