SlideShare a Scribd company logo
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

PDF
Advanced Git Tutorial
PPTX
PDF
Git Tricks — git utilities that make life git easier
PDF
My Notes from https://www.codeschool.com/courses/git-real
PDF
Git advanced
PPTX
PPTX
Git Pull Requests
PPTX
Advanced Git Presentation By Swawibe
Advanced Git Tutorial
Git Tricks — git utilities that make life git easier
My Notes from https://www.codeschool.com/courses/git-real
Git advanced
Git Pull Requests
Advanced Git Presentation By Swawibe

What's hot (20)

PDF
Git Tricks
PDF
Git Introduction Tutorial
KEY
The everyday developer's guide to version control with Git
PDF
Git & GitHub for Beginners
PDF
Git basics for beginners
PDF
Version control system
PPTX
Git Flow and JavaScript Coding Style
DOCX
Git github
PDF
Git real slides
PDF
Git and github - Verson Control for the Modern Developer
PDF
PPTX
Git One Day Training Notes
PPTX
Git 101
DOCX
Bitbucket
PDF
Introduction To Git For Version Control Architecture And Common Commands Comp...
PDF
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
PPTX
Introduction to Git / Github
PDF
Intro to Git and GitHub
PPTX
Git and git workflow best practice
PDF
Git Version Control System
Git Tricks
Git Introduction Tutorial
The everyday developer's guide to version control with Git
Git & GitHub for Beginners
Git basics for beginners
Version control system
Git Flow and JavaScript Coding Style
Git github
Git real slides
Git and github - Verson Control for the Modern Developer
Git One Day Training Notes
Git 101
Bitbucket
Introduction To Git For Version Control Architecture And Common Commands Comp...
Juliette Reinders Folmer - Promote your open source project with GitHub Pages...
Introduction to Git / Github
Intro to Git and GitHub
Git and git workflow best practice
Git Version Control System
Ad

Similar to Gitflow (20)

PDF
Git-flow workflow and pull-requests
PPTX
Gitflow - Branching and Merging Flow for Git
PPTX
Gitflow - Branching and Merging Flow for Git
PPTX
Version Control System Branching Strategies.pptx
PDF
Git with the flow
PDF
Git flow for daily use
PPTX
Gitflow - Clouddictive
PDF
Git and GitHub workflows
PDF
A Git Workflow Model or Branching Strategy
PDF
DcATL 2013: Git-Flow for Daily Use
PDF
Introducing Git and git flow
PPTX
Gitflow - Una metología para manejo de Branches
PDF
Git workflows automat-it
PDF
Gitflow Workflow
PDF
Git and git flow
PPTX
Why Aren't You Using Git Flow?
PPTX
git Technologies
PDF
Introduction to git flow
PPTX
Git development workflow
PDF
Real World Git Workflows - EclipseCon Europe 2013
Git-flow workflow and pull-requests
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
Version Control System Branching Strategies.pptx
Git with the flow
Git flow for daily use
Gitflow - Clouddictive
Git and GitHub workflows
A Git Workflow Model or Branching Strategy
DcATL 2013: Git-Flow for Daily Use
Introducing Git and git flow
Gitflow - Una metología para manejo de Branches
Git workflows automat-it
Gitflow Workflow
Git and git flow
Why Aren't You Using Git Flow?
git Technologies
Introduction to git flow
Git development workflow
Real World Git Workflows - EclipseCon Europe 2013
Ad

Recently uploaded (20)

PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
System and Network Administration Chapter 2
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
AI in Product Development-omnex systems
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
How to Choose the Right IT Partner for Your Business in Malaysia
wealthsignaloriginal-com-DS-text-... (1).pdf
System and Network Administration Chapter 2
Which alternative to Crystal Reports is best for small or large businesses.pdf
Operating system designcfffgfgggggggvggggggggg
AI in Product Development-omnex systems
PTS Company Brochure 2025 (1).pdf.......
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
Adobe Illustrator 28.6 Crack My Vision of Vector Design
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Reimagine Home Health with the Power of Agentic AI​
Upgrade and Innovation Strategies for SAP ERP Customers
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI Use Case- Contract Lifecycle Management (CLM).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

  • #4: 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.
  • #5: Linus Torvalds, the famous creator of the Linux operating system kernel.