SlideShare a Scribd company logo
1 of 23
Download to read offline
Git Workflows
How to Successfully Use Branching &
Development Workflow Strategies
Nik Gregory
Principal Engineer
Twitter: @nikgregory
Syllabus
→ Popular git branching and workflow methods
→ Dive into git branch-per-feature
→ Pitfalls of git branch-per-feature and avoiding them
→ Questions
About Me
→ Acquia Engineer since 2009
→ Initial QA/Test hire at Acquia
→ Worked with Acquia hosting, Site Factory…
Caveat Inspectoris
→ I am not a git ninja
▪ I know enough about git to get the job done and
google the rest
→ Git development workflows == emacs vs vi
▪ Pick what works for you and your team.
Long Running Branches
▪ Master is dev
▪ Releases are a branch
▪ Hotfixes get merged into master
▪ Not very different than CVS or SVN (release branches
are easier to handle)
Git fork
→ Maintainer controls merges into official repo
→ Often master is known good
→ Forkers pull from master as master moves
→ Often used in Open Source development
→ Useful in restricting access to the official repo
Branch per feature
→ Modified version of git-flow
→ Master is known good production code
→ Each story gets a new branch
→ Mitigates risk when pulling in lots of stories
→ QA and RC branches are built regularly
▪ Master + feature branches
→ Integration is used to catch merge conflicts
→ Shared rereres are your friend
Standing on the Shoulders of Giants
→ Based on the work of Adam Dymitruk
→ Refined by Katherine Bailey and myself
Git Branch-per-feature
Details
→ Create a branch from master for your stories
▪ git checkout master && git pull origin master && git checkout –b JIRA-1
▪ git checkout master && git pull origin master && git checkout –b JIRA-2
▪ …
→ Code like no one is watching, commit, push to origin
→ Merge your work into the integration/QA/RC branch
▪ git checkout <(integration|QA|RC)branch> && git pull …
▪ git pull –no-rebase –no-ff [--no-edit] origin JIRA-1
▪ …
Merge Conflicts
→ Use your integration branch as the conflict detector
→ Use git rerere to record your conflict resolutions.
→ Share your rereres with the git-bpf gem
→ Rebuild your QA/RC branches as needed
→ Recreate Integration from master as master moves
Quick and dirty examples
→ Install (gem install git_bpf) and initialize git-bpf
Cont…
→ Build your branch
Record resolutions
Fix your stuff git-bpf will share your resolution
Rebuild your branch
Add more work and rebuild
Exclude branches
Advantages
→ Usually trivial to pull out stories (see the Q&D earlier)
→ Story branches always start from the tip of master
→ Rebase is no longer scary
→ Rebuild your QA/RC branches as needed
Advantages, even more
→ You do not need to release broken code!
→ Run through tests and things go sideways
▪ Rebuild a new RC
▪ Validate
→ No panic feature flags!
→ Master is still known good best code.
→ To reiterate: the most important advantage is being able to
NOT release stories
Pitfalls
→ Overhead to deal with many branches and merging
→ Common code changes are needed among several branches
▪ Are your stories nice independent releasable units?
▪ Can you use a parent /child branch to share?
→ Incorrect Resolution is recorded.
▪ Minor brain surgery on .git/rr-cache
→ Pulling out branches sometimes requires new rereres
▪ Are you all working in the same section of code?
→ If master moves rebase your branches to HEAD of master
Questions?
Resources
→ Kat Bailey’s writeup: https://dev.acquia.com/blog/pragmatic-guide-branch-
feature-git-branching-strategy
→ Our jumping off point http://dymitruk.com/blog/2012/02/05/branch-per-
feature/
→ git-bpf gem
→ Git-flow http://nvie.com/posts/a-successful-git-branching-model/
→ Git command visualizations http://onlywei.github.io/explain-git-with-d3
Thank You

More Related Content

More from Acquia

May Partner Bootcamp 2022
May Partner Bootcamp 2022May Partner Bootcamp 2022
May Partner Bootcamp 2022Acquia
 
April Partner Bootcamp 2022
April Partner Bootcamp 2022April Partner Bootcamp 2022
April Partner Bootcamp 2022Acquia
 
How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story Acquia
 
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXUsing Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXAcquia
 
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowImprove Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowAcquia
 
September Partner Bootcamp
September Partner BootcampSeptember Partner Bootcamp
September Partner BootcampAcquia
 
August partner bootcamp
August partner bootcampAugust partner bootcamp
August partner bootcampAcquia
 
July 2021 Partner Bootcamp
July  2021 Partner BootcampJuly  2021 Partner Bootcamp
July 2021 Partner BootcampAcquia
 
May Partner Bootcamp
May Partner BootcampMay Partner Bootcamp
May Partner BootcampAcquia
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYDRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYAcquia
 
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineWork While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineAcquia
 
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia
 
April partner bootcamp deck cookieless future
April partner bootcamp deck  cookieless futureApril partner bootcamp deck  cookieless future
April partner bootcamp deck cookieless futureAcquia
 
How to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsHow to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsAcquia
 
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...Acquia
 
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Acquia
 
Leave Local Dev Behind: Start Writing Your Code In The Cloud
Leave Local Dev Behind: Start Writing Your Code In The CloudLeave Local Dev Behind: Start Writing Your Code In The Cloud
Leave Local Dev Behind: Start Writing Your Code In The CloudAcquia
 
Overwhelmed with data from different sources and systems?
Overwhelmed with data from different sources and systems?Overwhelmed with data from different sources and systems?
Overwhelmed with data from different sources and systems?Acquia
 
You've got a CDP, so what?
You've got a CDP, so what?You've got a CDP, so what?
You've got a CDP, so what?Acquia
 
CDP vs CRM - What's the difference?
CDP vs CRM - What's the difference?CDP vs CRM - What's the difference?
CDP vs CRM - What's the difference?Acquia
 

More from Acquia (20)

May Partner Bootcamp 2022
May Partner Bootcamp 2022May Partner Bootcamp 2022
May Partner Bootcamp 2022
 
April Partner Bootcamp 2022
April Partner Bootcamp 2022April Partner Bootcamp 2022
April Partner Bootcamp 2022
 
How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story
 
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXUsing Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
 
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowImprove Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
 
September Partner Bootcamp
September Partner BootcampSeptember Partner Bootcamp
September Partner Bootcamp
 
August partner bootcamp
August partner bootcampAugust partner bootcamp
August partner bootcamp
 
July 2021 Partner Bootcamp
July  2021 Partner BootcampJuly  2021 Partner Bootcamp
July 2021 Partner Bootcamp
 
May Partner Bootcamp
May Partner BootcampMay Partner Bootcamp
May Partner Bootcamp
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYDRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
 
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineWork While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
 
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
 
April partner bootcamp deck cookieless future
April partner bootcamp deck  cookieless futureApril partner bootcamp deck  cookieless future
April partner bootcamp deck cookieless future
 
How to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsHow to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutions
 
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
 
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
 
Leave Local Dev Behind: Start Writing Your Code In The Cloud
Leave Local Dev Behind: Start Writing Your Code In The CloudLeave Local Dev Behind: Start Writing Your Code In The Cloud
Leave Local Dev Behind: Start Writing Your Code In The Cloud
 
Overwhelmed with data from different sources and systems?
Overwhelmed with data from different sources and systems?Overwhelmed with data from different sources and systems?
Overwhelmed with data from different sources and systems?
 
You've got a CDP, so what?
You've got a CDP, so what?You've got a CDP, so what?
You've got a CDP, so what?
 
CDP vs CRM - What's the difference?
CDP vs CRM - What's the difference?CDP vs CRM - What's the difference?
CDP vs CRM - What's the difference?
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 CVKhem
 
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 2024SynarionITSolutions
 
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.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
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
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

How to Successfully Use Branching and Development Workflow Strategies

  • 1. Git Workflows How to Successfully Use Branching & Development Workflow Strategies Nik Gregory Principal Engineer Twitter: @nikgregory
  • 2. Syllabus → Popular git branching and workflow methods → Dive into git branch-per-feature → Pitfalls of git branch-per-feature and avoiding them → Questions
  • 3. About Me → Acquia Engineer since 2009 → Initial QA/Test hire at Acquia → Worked with Acquia hosting, Site Factory…
  • 4. Caveat Inspectoris → I am not a git ninja ▪ I know enough about git to get the job done and google the rest → Git development workflows == emacs vs vi ▪ Pick what works for you and your team.
  • 5. Long Running Branches ▪ Master is dev ▪ Releases are a branch ▪ Hotfixes get merged into master ▪ Not very different than CVS or SVN (release branches are easier to handle)
  • 6. Git fork → Maintainer controls merges into official repo → Often master is known good → Forkers pull from master as master moves → Often used in Open Source development → Useful in restricting access to the official repo
  • 7. Branch per feature → Modified version of git-flow → Master is known good production code → Each story gets a new branch → Mitigates risk when pulling in lots of stories → QA and RC branches are built regularly ▪ Master + feature branches → Integration is used to catch merge conflicts → Shared rereres are your friend
  • 8. Standing on the Shoulders of Giants → Based on the work of Adam Dymitruk → Refined by Katherine Bailey and myself
  • 10. Details → Create a branch from master for your stories ▪ git checkout master && git pull origin master && git checkout –b JIRA-1 ▪ git checkout master && git pull origin master && git checkout –b JIRA-2 ▪ … → Code like no one is watching, commit, push to origin → Merge your work into the integration/QA/RC branch ▪ git checkout <(integration|QA|RC)branch> && git pull … ▪ git pull –no-rebase –no-ff [--no-edit] origin JIRA-1 ▪ …
  • 11. Merge Conflicts → Use your integration branch as the conflict detector → Use git rerere to record your conflict resolutions. → Share your rereres with the git-bpf gem → Rebuild your QA/RC branches as needed → Recreate Integration from master as master moves
  • 12. Quick and dirty examples → Install (gem install git_bpf) and initialize git-bpf
  • 14. Record resolutions Fix your stuff git-bpf will share your resolution
  • 16. Add more work and rebuild
  • 18. Advantages → Usually trivial to pull out stories (see the Q&D earlier) → Story branches always start from the tip of master → Rebase is no longer scary → Rebuild your QA/RC branches as needed
  • 19. Advantages, even more → You do not need to release broken code! → Run through tests and things go sideways ▪ Rebuild a new RC ▪ Validate → No panic feature flags! → Master is still known good best code. → To reiterate: the most important advantage is being able to NOT release stories
  • 20. Pitfalls → Overhead to deal with many branches and merging → Common code changes are needed among several branches ▪ Are your stories nice independent releasable units? ▪ Can you use a parent /child branch to share? → Incorrect Resolution is recorded. ▪ Minor brain surgery on .git/rr-cache → Pulling out branches sometimes requires new rereres ▪ Are you all working in the same section of code? → If master moves rebase your branches to HEAD of master
  • 22. Resources → Kat Bailey’s writeup: https://dev.acquia.com/blog/pragmatic-guide-branch- feature-git-branching-strategy → Our jumping off point http://dymitruk.com/blog/2012/02/05/branch-per- feature/ → git-bpf gem → Git-flow http://nvie.com/posts/a-successful-git-branching-model/ → Git command visualizations http://onlywei.github.io/explain-git-with-d3