SlideShare a Scribd company logo
1 of 35
Gitflow
Note by me...
Bui Huu Phuoc,
Ho Chi Minh city, 17/07/2020
Contents
- Version Control Software
- Git
- Gitflow by Vincent Driessen
- GitHub Flow
- Combine GitHub and Gitflow
- “Linh tinh”
- References
Version Control Software
- Git
- Mercurial
- CVS - Concurrent Versions System
- SVN - Apache Subversion
- ...
Git
- Git is a free and open source distributed
version control system.
- Git was created by Linus Torvalds in
2005.
- Written in C, Shell, Perl, TCL (Tool
Command Language), and Python.
Gitflow by Vincent Driessen
● This model was conceived in 2010.
● Has become hugely popular in many a
software team.
→ A successful Git branching model.
Gitflow →
Decentralized but centralized
Gitflow →
Branches
- Main branches:
- master
- develop
- Supporting branches:
- Feature branches
- Release branches
- Hotfix branches
Gitflow → Branches →
Main branches
- master: HEAD always reflects a production-ready state
- develop (Integration branch): HEAD always reflects a
state with the latest delivered development changes for the
next release
→ develop branch reaches a stable point and is ready to be
released, all of the changes should be merged back into master
somehow and then tagged with a release number.
Gitflow → Branches →
Supporting branches
- Feature branches
- Release branches
- Hotfix branches
May branch off from:
develop
Must merge back into:
develop
Branch naming convention:
anything except master, develop, release-*, or hotfix-*
Gitflow → Branches → Supporting branches →
Feature branches
Creating a feature branch
$ git checkout -b myfeature develop
Switched to a new branch "myfeature"
Incorporating a finished feature on develop
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature
Updating ea1b82a..05e9557
(Summary of changes)
$ git branch -d myfeature
Deleted branch myfeature (was 05e9557).
$ git push origin develop
Gitflow → Branches → Supporting branches →
Feature branches
● The --no-ff flag causes the merge to always create a
new commit object.
● This avoids losing information about the historical
existence of a feature branch.
Gitflow → Branches → Supporting branches →
Feature branches
May branch off from:
develop
Must merge back into:
develop and master
Branch naming convention:
release-*
Gitflow → Branches → Supporting branches →
Release branches
Creating a release branch
$ git checkout -b release-1.2 develop
Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
$ git commit -a -m "Bumped version number to 1.2"
[release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions(+), 1 deletions(-)
Gitflow → Branches → Supporting branches →
Release branches
Merge back into master
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release-1.2
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2
Merge back into develop
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff release-1.2
Merge made by recursive.
(Summary of changes)
$ git branch -d release-1.2
Deleted branch release-1.2 (was ff452fe).
Gitflow → Branches → Supporting branches →
Release branches
May branch off from:
master
Must merge back into:
develop and master
Branch naming convention:
hotfix-*
Gitflow → Branches → Supporting branches →
Hotfix branches
Creating a hotfix branch
$ git checkout -b hotfix-1.2.1 master
Switched to a new branch "hotfix-1.2.1"
$ ./bump-version.sh 1.2.1
Files modified successfully, version bumped to 1.2.1.
$ git commit -m "Bumped version number to 1.2.1"
[hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
1 files changed, 1 insertions(+), 1 deletions(-)
$ git commit -m "Fixed severe production problem"
[hotfix-1.2.1 abbe5d6] Fixed severe production problem
5 files changed, 32 insertions(+), 17 deletions(-)
Gitflow → Branches → Supporting branches →
Hotfix branches
Merge back into master
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2.1
Merge back into develop
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git branch -d hotfix-1.2.1
Deleted branch hotfix-1.2.1 (was abbe5d6).
Gitflow → Branches → Supporting branches →
Hotfix branches
Gitflow by Vincent Driessen
GitHub Flow
Combine Github and Gitflow
- Prepare
- Procedure
- Conflict code
Combine GitHub and Gitflow →
Prepare
1. On GitHub (or Bitbucket) fork the central repository to your account.
1. Clone your forked repository
$ git clone [Forked repository URL]
1. Go to your folder cloned
$ cd [Your folder cloned]
1. Add your central remote
$ git remote add [upstream] [Your central repo URL]
Combine GitHub and Gitflow →
Procedure
1. Checkout to develop branch
$ git checkout develop
1. Sync local’s develop with upstream
$ git pull upstream develop
1. Create a new branch to make a new feature.
$ git checkout -b your_feature
1. Implement your feature, and commit something after finished
$ git add -A
$ git commit -m “This is my first commit”
Combine GitHub and Gitflow →
Procedure
5. Push your code to forked repository
$ git push origin your_feature
5. Create your pull request to develop’s central repository
5. Teammates review your code.
1. Your code approved by 2 members or more, next step 8.
2. Your code need to change something, back step 4.
5. Team leader merge your pull request → Done
1. Checkout to develop branch
$ git checkout develop
1. Sync develop local with upstream
$ git pull upstream develop
3. Checkout to your_feature branch
$ git checkout your_feature
Combine GitHub and Gitflow → Procedure →
Conflict code
Combine GitHub and Gitflow → Procedure →
Conflict code
4. Rebase with develop
$ git rebase develop
4. Conflict occurred
○ --continue
○ --skip
○ --abort
4. Fixed conflict
$ git add -A
$ git rebase --continue
4. Push your code
$ git push origin my_fetaure --force
First, rewinding head to replay your work on top of it...
Applying: refs
...
Auto-merging path/to/conflicting/file
CONFLICT (add/add): Merge conflict in path/to/conflicting/file
Failed to merge in the changes.
...
The copy of the patch that failed is found in:
/path/to/working/dir/.git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
“Linh tinh”
- rebase and merge
- cherry-pick, how to use?
- reflog
- stash
“Linh tinh” →
rebase and merge
Current commit history
Merged master into feature branch
“Linh tinh” →
rebase and merge
Rebased feature onto master
“Linh tinh” →
rebase and merge
“Linh tinh” →
cherry-pick
git cherry-pick commitSha
$ git checkout master
$ git cherry-pick f
Option:
● -edit
● --no-commit
● --signoff
“Linh tinh” →
reflog
$ git reflog <subcommand> <options>
“Linh tinh” →
stash
$ git stash save 'my brand new stashoptional'
$ git stash list
stash@{0}: On my-branch: my brand new stash
stash@{1}: WIP on my-branch: ca96af0 Commit message
3
stash@{2}: WIP on my-branch: 03af20c Commit message
2
stash@{3}: WIP on my-branch: 216b662 Commit message
1
$ git stash apply stash@{1}optional
$ git pop stash@{2}optional
$ git stash drop stash@{1}optional
$ git stash clear
References
1. A successful Git branching model
2. Git SCM
3. Version Control Software Comparison
4. Git Wikipedia
5. Understanding the GitHub flow
6. Framgia Gitflow
7. Cherry Pick
8. How Git Stash Can Help You Juggle Multiple Branches
Gitflow

More Related Content

What's hot

Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction TutorialThomas Rausch
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Version control system
Version control systemVersion control system
Version control systemAndrew Liu
 
Git Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleGit Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleBo-Yi Wu
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...SlideTeam
 
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...Codemotion
 
Introduction to Git / Github
Introduction to Git / GithubIntroduction to Git / Github
Introduction to Git / GithubPaige Bailey
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practiceMajid Hosseini
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 

What's hot (20)

Git Tricks
Git TricksGit Tricks
Git Tricks
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Version control system
Version control systemVersion control system
Version control system
 
Git Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleGit Flow and JavaScript Coding Style
Git Flow and JavaScript Coding Style
 
Git github
Git githubGit github
Git github
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Git SCM
Git SCMGit SCM
Git SCM
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git 101
Git 101Git 101
Git 101
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
 
Introduction to Git / Github
Introduction to Git / GithubIntroduction to Git / Github
Introduction to Git / Github
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 

Similar to Gitflow

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 GitMaulik 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 GitMaulik Shah
 
Git development workflow
Git development workflowGit development workflow
Git development workflowSankar Suda
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyVivek Parihar
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Codemotion
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developersWim Godden
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Effective Git with Eclipse
Effective Git with EclipseEffective Git with Eclipse
Effective Git with EclipseChris Aniszczyk
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 
Git - Version Control System
Git - Version Control SystemGit - Version Control System
Git - Version Control SystemNamig Hajiyev
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - WorkflowTahsin Abrar
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git TogetherRakesh Jha
 

Similar to Gitflow (20)

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
 
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
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git basics
Git basicsGit basics
Git basics
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Effective Git with Eclipse
Effective Git with EclipseEffective Git with Eclipse
Effective Git with Eclipse
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
Git - Version Control System
Git - Version Control SystemGit - Version Control System
Git - Version Control System
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Demystifying Git
Demystifying GitDemystifying Git
Demystifying Git
 
Git
GitGit
Git
 

Recently uploaded

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Recently uploaded (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

Gitflow

  • 1. Gitflow Note by me... Bui Huu Phuoc, Ho Chi Minh city, 17/07/2020
  • 2. Contents - Version Control Software - Git - Gitflow by Vincent Driessen - GitHub Flow - Combine GitHub and Gitflow - “Linh tinh” - References
  • 3. Version Control Software - Git - Mercurial - CVS - Concurrent Versions System - SVN - Apache Subversion - ...
  • 4. Git - Git is a free and open source distributed version control system. - Git was created by Linus Torvalds in 2005. - Written in C, Shell, Perl, TCL (Tool Command Language), and Python.
  • 5. Gitflow by Vincent Driessen ● This model was conceived in 2010. ● Has become hugely popular in many a software team. → A successful Git branching model.
  • 7. Gitflow → Branches - Main branches: - master - develop - Supporting branches: - Feature branches - Release branches - Hotfix branches
  • 8. Gitflow → Branches → Main branches - master: HEAD always reflects a production-ready state - develop (Integration branch): HEAD always reflects a state with the latest delivered development changes for the next release → develop branch reaches a stable point and is ready to be released, all of the changes should be merged back into master somehow and then tagged with a release number.
  • 9. Gitflow → Branches → Supporting branches - Feature branches - Release branches - Hotfix branches
  • 10. May branch off from: develop Must merge back into: develop Branch naming convention: anything except master, develop, release-*, or hotfix-* Gitflow → Branches → Supporting branches → Feature branches
  • 11. Creating a feature branch $ git checkout -b myfeature develop Switched to a new branch "myfeature" Incorporating a finished feature on develop $ git checkout develop Switched to branch 'develop' $ git merge --no-ff myfeature Updating ea1b82a..05e9557 (Summary of changes) $ git branch -d myfeature Deleted branch myfeature (was 05e9557). $ git push origin develop Gitflow → Branches → Supporting branches → Feature branches
  • 12. ● The --no-ff flag causes the merge to always create a new commit object. ● This avoids losing information about the historical existence of a feature branch. Gitflow → Branches → Supporting branches → Feature branches
  • 13. May branch off from: develop Must merge back into: develop and master Branch naming convention: release-* Gitflow → Branches → Supporting branches → Release branches
  • 14. Creating a release branch $ git checkout -b release-1.2 develop Switched to a new branch "release-1.2" $ ./bump-version.sh 1.2 Files modified successfully, version bumped to 1.2. $ git commit -a -m "Bumped version number to 1.2" [release-1.2 74d9424] Bumped version number to 1.2 1 files changed, 1 insertions(+), 1 deletions(-) Gitflow → Branches → Supporting branches → Release branches
  • 15. Merge back into master $ git checkout master Switched to branch 'master' $ git merge --no-ff release-1.2 Merge made by recursive. (Summary of changes) $ git tag -a 1.2 Merge back into develop $ git checkout develop Switched to branch 'develop' $ git merge --no-ff release-1.2 Merge made by recursive. (Summary of changes) $ git branch -d release-1.2 Deleted branch release-1.2 (was ff452fe). Gitflow → Branches → Supporting branches → Release branches
  • 16. May branch off from: master Must merge back into: develop and master Branch naming convention: hotfix-* Gitflow → Branches → Supporting branches → Hotfix branches
  • 17. Creating a hotfix branch $ git checkout -b hotfix-1.2.1 master Switched to a new branch "hotfix-1.2.1" $ ./bump-version.sh 1.2.1 Files modified successfully, version bumped to 1.2.1. $ git commit -m "Bumped version number to 1.2.1" [hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1 1 files changed, 1 insertions(+), 1 deletions(-) $ git commit -m "Fixed severe production problem" [hotfix-1.2.1 abbe5d6] Fixed severe production problem 5 files changed, 32 insertions(+), 17 deletions(-) Gitflow → Branches → Supporting branches → Hotfix branches
  • 18. Merge back into master $ git checkout master Switched to branch 'master' $ git merge --no-ff hotfix-1.2.1 Merge made by recursive. (Summary of changes) $ git tag -a 1.2.1 Merge back into develop $ git checkout develop Switched to branch 'develop' $ git merge --no-ff hotfix-1.2.1 Merge made by recursive. (Summary of changes) $ git branch -d hotfix-1.2.1 Deleted branch hotfix-1.2.1 (was abbe5d6). Gitflow → Branches → Supporting branches → Hotfix branches
  • 19. Gitflow by Vincent Driessen
  • 21. Combine Github and Gitflow - Prepare - Procedure - Conflict code
  • 22. Combine GitHub and Gitflow → Prepare 1. On GitHub (or Bitbucket) fork the central repository to your account. 1. Clone your forked repository $ git clone [Forked repository URL] 1. Go to your folder cloned $ cd [Your folder cloned] 1. Add your central remote $ git remote add [upstream] [Your central repo URL]
  • 23. Combine GitHub and Gitflow → Procedure 1. Checkout to develop branch $ git checkout develop 1. Sync local’s develop with upstream $ git pull upstream develop 1. Create a new branch to make a new feature. $ git checkout -b your_feature 1. Implement your feature, and commit something after finished $ git add -A $ git commit -m “This is my first commit”
  • 24. Combine GitHub and Gitflow → Procedure 5. Push your code to forked repository $ git push origin your_feature 5. Create your pull request to develop’s central repository 5. Teammates review your code. 1. Your code approved by 2 members or more, next step 8. 2. Your code need to change something, back step 4. 5. Team leader merge your pull request → Done
  • 25. 1. Checkout to develop branch $ git checkout develop 1. Sync develop local with upstream $ git pull upstream develop 3. Checkout to your_feature branch $ git checkout your_feature Combine GitHub and Gitflow → Procedure → Conflict code
  • 26. Combine GitHub and Gitflow → Procedure → Conflict code 4. Rebase with develop $ git rebase develop 4. Conflict occurred ○ --continue ○ --skip ○ --abort 4. Fixed conflict $ git add -A $ git rebase --continue 4. Push your code $ git push origin my_fetaure --force First, rewinding head to replay your work on top of it... Applying: refs ... Auto-merging path/to/conflicting/file CONFLICT (add/add): Merge conflict in path/to/conflicting/file Failed to merge in the changes. ... The copy of the patch that failed is found in: /path/to/working/dir/.git/rebase-apply/patch When you have resolved this problem, run "git rebase --continue". If you prefer to skip this patch, run "git rebase --skip" instead. To check out the original branch and stop rebasing, run "git rebase --abort".
  • 27. “Linh tinh” - rebase and merge - cherry-pick, how to use? - reflog - stash
  • 28. “Linh tinh” → rebase and merge Current commit history
  • 29. Merged master into feature branch “Linh tinh” → rebase and merge
  • 30. Rebased feature onto master “Linh tinh” → rebase and merge
  • 31. “Linh tinh” → cherry-pick git cherry-pick commitSha $ git checkout master $ git cherry-pick f Option: ● -edit ● --no-commit ● --signoff
  • 32. “Linh tinh” → reflog $ git reflog <subcommand> <options>
  • 33. “Linh tinh” → stash $ git stash save 'my brand new stashoptional' $ git stash list stash@{0}: On my-branch: my brand new stash stash@{1}: WIP on my-branch: ca96af0 Commit message 3 stash@{2}: WIP on my-branch: 03af20c Commit message 2 stash@{3}: WIP on my-branch: 216b662 Commit message 1 $ git stash apply stash@{1}optional $ git pop stash@{2}optional $ git stash drop stash@{1}optional $ git stash clear
  • 34. References 1. A successful Git branching model 2. Git SCM 3. Version Control Software Comparison 4. Git Wikipedia 5. Understanding the GitHub flow 6. Framgia Gitflow 7. Cherry Pick 8. How Git Stash Can Help You Juggle Multiple Branches

Editor's Notes

  1. Having a distributed architecture, Git is an example of a DVCS (hence Distributed Version Control System). Rather than have only one single place for the full version history of the software as is common in once-popular version control systems like CVS or Subversion (also known as SVN), in Git, every developer's working copy of the code is also a repository that can contain the full history of all changes.
  2. Linus Torvalds, the famous creator of the Linux operating system kernel.