SlideShare a Scribd company logo
feature
branch
master
= production, stable
develop
= future production,
QA-grade
dev/cool
branch
feature
branch
dev/awesome
develop + cool
commit and push
branch regularly
Pull request
review PR,
commit any changes to dev/cool,
merge PR into develop,
delete dev/cool
“cool” commits
more “awesome” commits
rebase
dev/awesome
onto develop
dev/awesome
now includes
dev/cool features
develop + cool +
awesome
Pull request
review PR,
commit any changes to dev/awesome,
merge PR into develop,
delete dev/awesome
master
Pull request
push to prod
test on dev env
push to staging
test on dev env
the rebase moves things forward
initial “awesome” commits
initial “awesome” commits
master
= production, stable
develop
= future production,
QA grade
dev/cool
= integration branch
for big feature
branch
integration
branch
for big feature
feature/neato
dev/cool + neato
Pull request
review PR,
commit any changes to neato,
merge PR into dev/cool
delete neato
feature/nifty
sub-feature
branches
feature/nifty now
includes
dev/neato
features
rebase feature/nifty
onto dev/cool
the rebase “moves” prior nifty commits past the neato commits
(technically, it moves the point where nifty branched off ahead,
and the commits move with it)
nifty commits, batch 1 nifty commits, batch 1
nifty commits, batch 2
dev/cool + neato +
nifty
Pull request
review PR,
commit any changes to nifty,
merge PR into dev/cool
delete nifty
Pull request
develop
master
Pull request
merge
merge
develop + feature X
develop + feature X
+ feature Y
feature X PR merge
rebase
feature Y PR merge
rebase
$ git checkout develop; git pull # make sure my develop is up to date
$ git checkout -b dev/cool # create my branch
$ vi WarpCore.java FluxCapacitor.java # make changes
$ git commit -m “upgraded intake manifold in flux capacitor” WarpCore.java FluxCapacitor.java # commit
$ git push origin dev/cool # save changes in shared repo
Then:
· go to github and file a PR for dev/cool
· have someone review and merge your PR into develop
· have someone delete dev/cool
· other devs using branches off develop now rebase their branches onto develop to get the cool feature
· at next commit, other devs who rebased will need to push -f because of the rebase
· repeat ad infinitum
Basic Example
Joe and Jill are working on a big feature. Joe does:
$ git checkout develop; git pull # make sure Joe’s develop is up to date
$ git checkout -b dev/cool # create an integration branch for a big feature
$ git push origin dev/cool # put integration branch in shared repo for Jill
$ git checkout -b feature/neato # create sub-feature branch for neato sub-feature
$ vi WarpCore.java FluxCapacitor.java # make changes
$ git commit -m “upgraded intake manifold in flux capacitor” WarpCore.java FluxCapacitor.java # commit
$ git push origin feature/neato # save changes in shared repo
On her own schedule, Jill does:
$ git checkout dev/cool; git pull # get Joe’s integration branch
$ git checkout -b feature/nifty # create sub-feature branch for nifty sub-feature
$ vi Manifold.java # make changes
$ git commit -m “recalibrated intake manifold” Manifold.java # commit
$ git push origin feature/nifty # save changes in shared repo
Joe files a PR and gets his neato feature tested and merged into dev/cool. Jill wants to stay up to date:
$ git rebase dev/cool # brings in Joe’s changes and keeps Jill’s commits together, after Joe’s
$ vi Tribble.java # more changes
$ git commit -m “upped sensitivity to Klingons” Tribble.java
$ git push -f origin feature/nifty # save Jill’s changes in shared repo; -f after rebase
When done, Jill files a PR and gets her nifty feature tested and merged into dev/cool.
Then when dev/cool is feature complete, a PR is filed to do integration testing and merge into develop.
Feature Branch Example
·Thou shalt merge down and rebase up
·Thou shalt branch for everything (features & bug fixes)
·Thou shalt keep thy branches very short-lived
·Thou shalt keep master production-grade, ready to deploy, always
·Thou shalt push often
·Thou shalt pull often
·Thou shalt rebase often
·Thou shalt not commit directly into develop (penalty: waterboarding)
·Thou shalt not commit directly into master (penalty: violent death)
·Thou shalt not merge branches without a PR
The Ten Commandments of Git
Ad

More Related Content

What's hot (6)

Using Chef and Vagrant at Gengo
Using Chef and Vagrant at GengoUsing Chef and Vagrant at Gengo
Using Chef and Vagrant at Gengo
Gengo
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
Culture of working together with git
Culture of working together  with gitCulture of working together  with git
Culture of working together with git
ibrahimgunduz34
 
Git flow
Git flowGit flow
Git flow
Valerio Como
 
Git workflow
Git workflowGit workflow
Git workflow
Arif Huda
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?
John Congdon
 
Using Chef and Vagrant at Gengo
Using Chef and Vagrant at GengoUsing Chef and Vagrant at Gengo
Using Chef and Vagrant at Gengo
Gengo
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
David Paluy
 
Culture of working together with git
Culture of working together  with gitCulture of working together  with git
Culture of working together with git
ibrahimgunduz34
 
Git workflow
Git workflowGit workflow
Git workflow
Arif Huda
 
Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?Why Aren't You Using Git Flow?
Why Aren't You Using Git Flow?
John Congdon
 

Similar to A painless git workflow (20)

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Git workshop
Git workshopGit workshop
Git workshop
Ray Toal
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Git
GitGit
Git
Maks Charuk
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Lightning branches at RedMart (Js conf Asia 2014  Talk)Lightning branches at RedMart (Js conf Asia 2014  Talk)
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Ritesh Angural
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with git
Joseluis Laso
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Lemi Orhan Ergin
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
Pham Quy (Jack)
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Lemi Orhan Ergin
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
mpvanwinkle
 
Git basics
Git basicsGit basics
Git basics
Amit Sawhney
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
Tagged Social
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT Workshop
Anis Ahmad
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
Mythri P K
 
Everything in code_slides
Everything in code_slidesEverything in code_slides
Everything in code_slides
Mack Hardy
 
Session git
Session gitSession git
Session git
Roni Saha
 
Git cheat sheet
Git cheat sheetGit cheat sheet
Git cheat sheet
Piyush Mittal
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 
Git workshop
Git workshopGit workshop
Git workshop
Ray Toal
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
viniciusban
 
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Lightning branches at RedMart (Js conf Asia 2014  Talk)Lightning branches at RedMart (Js conf Asia 2014  Talk)
Lightning branches at RedMart (Js conf Asia 2014 Talk)
Ritesh Angural
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with git
Joseluis Laso
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Lemi Orhan Ergin
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Maulik Shah
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Lemi Orhan Ergin
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
mpvanwinkle
 
VCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT WorkshopVCS for Teamwork - GIT Workshop
VCS for Teamwork - GIT Workshop
Anis Ahmad
 
2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final2015-ghci-presentation-git_gerritJenkins_final
2015-ghci-presentation-git_gerritJenkins_final
Mythri P K
 
Everything in code_slides
Everything in code_slidesEverything in code_slides
Everything in code_slides
Mack Hardy
 
Ad

Recently uploaded (20)

Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
#AdminHour presents: Hour of Code2018 slide deck from 12/6/2018
Lynda Kane
 
Salesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docxSalesforce AI Associate 2 of 2 Certification.docx
Salesforce AI Associate 2 of 2 Certification.docx
José Enrique López Rivera
 
Buckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug LogsBuckeye Dreamin' 2023: De-fogging Debug Logs
Buckeye Dreamin' 2023: De-fogging Debug Logs
Lynda Kane
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Datastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptxDatastucture-Unit 4-Linked List Presentation.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
kaleeswaric3
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko"Rebranding for Growth", Anna Velykoivanenko
"Rebranding for Growth", Anna Velykoivanenko
Fwdays
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Ad

A painless git workflow

  • 1. feature branch master = production, stable develop = future production, QA-grade dev/cool branch feature branch dev/awesome develop + cool commit and push branch regularly Pull request review PR, commit any changes to dev/cool, merge PR into develop, delete dev/cool “cool” commits more “awesome” commits rebase dev/awesome onto develop dev/awesome now includes dev/cool features develop + cool + awesome Pull request review PR, commit any changes to dev/awesome, merge PR into develop, delete dev/awesome master Pull request push to prod test on dev env push to staging test on dev env the rebase moves things forward initial “awesome” commits initial “awesome” commits
  • 2. master = production, stable develop = future production, QA grade dev/cool = integration branch for big feature branch integration branch for big feature feature/neato dev/cool + neato Pull request review PR, commit any changes to neato, merge PR into dev/cool delete neato feature/nifty sub-feature branches feature/nifty now includes dev/neato features rebase feature/nifty onto dev/cool the rebase “moves” prior nifty commits past the neato commits (technically, it moves the point where nifty branched off ahead, and the commits move with it) nifty commits, batch 1 nifty commits, batch 1 nifty commits, batch 2 dev/cool + neato + nifty Pull request review PR, commit any changes to nifty, merge PR into dev/cool delete nifty Pull request develop master Pull request merge merge develop + feature X develop + feature X + feature Y feature X PR merge rebase feature Y PR merge rebase
  • 3. $ git checkout develop; git pull # make sure my develop is up to date $ git checkout -b dev/cool # create my branch $ vi WarpCore.java FluxCapacitor.java # make changes $ git commit -m “upgraded intake manifold in flux capacitor” WarpCore.java FluxCapacitor.java # commit $ git push origin dev/cool # save changes in shared repo Then: · go to github and file a PR for dev/cool · have someone review and merge your PR into develop · have someone delete dev/cool · other devs using branches off develop now rebase their branches onto develop to get the cool feature · at next commit, other devs who rebased will need to push -f because of the rebase · repeat ad infinitum Basic Example
  • 4. Joe and Jill are working on a big feature. Joe does: $ git checkout develop; git pull # make sure Joe’s develop is up to date $ git checkout -b dev/cool # create an integration branch for a big feature $ git push origin dev/cool # put integration branch in shared repo for Jill $ git checkout -b feature/neato # create sub-feature branch for neato sub-feature $ vi WarpCore.java FluxCapacitor.java # make changes $ git commit -m “upgraded intake manifold in flux capacitor” WarpCore.java FluxCapacitor.java # commit $ git push origin feature/neato # save changes in shared repo On her own schedule, Jill does: $ git checkout dev/cool; git pull # get Joe’s integration branch $ git checkout -b feature/nifty # create sub-feature branch for nifty sub-feature $ vi Manifold.java # make changes $ git commit -m “recalibrated intake manifold” Manifold.java # commit $ git push origin feature/nifty # save changes in shared repo Joe files a PR and gets his neato feature tested and merged into dev/cool. Jill wants to stay up to date: $ git rebase dev/cool # brings in Joe’s changes and keeps Jill’s commits together, after Joe’s $ vi Tribble.java # more changes $ git commit -m “upped sensitivity to Klingons” Tribble.java $ git push -f origin feature/nifty # save Jill’s changes in shared repo; -f after rebase When done, Jill files a PR and gets her nifty feature tested and merged into dev/cool. Then when dev/cool is feature complete, a PR is filed to do integration testing and merge into develop. Feature Branch Example
  • 5. ·Thou shalt merge down and rebase up ·Thou shalt branch for everything (features & bug fixes) ·Thou shalt keep thy branches very short-lived ·Thou shalt keep master production-grade, ready to deploy, always ·Thou shalt push often ·Thou shalt pull often ·Thou shalt rebase often ·Thou shalt not commit directly into develop (penalty: waterboarding) ·Thou shalt not commit directly into master (penalty: violent death) ·Thou shalt not merge branches without a PR The Ten Commandments of Git