SlideShare a Scribd company logo
1 of 27
Download to read offline
Git-flow
& pull requests
Bartosz Kosarzycki Apr 15, 2016
Git-flow & pull requests
AGENDA
❏ Git competition?
❏ Git workflows
❏ Gitflow workflow
❏ GF: Historical branches
❏ GF: Feature branches
❏ GF: Maintenance & Release branches
❏ Pull-requests
❏ Issues with gitflow
❏ Github-flow, git-lab flow
❏ Merge vs rebase
❏ Git stash vs temporary branches
❏ Reflog
❏ Commit granularity
❏ Comparison of git desktop clients
Git competition ? ● mercurial is almost history
● main difference was better windows
support in mercurial and discouraging
rebasing as faking history of commits
Stackoverflow: questions tagged7,103 68,906
Git competition ?
Workflows
● like SVN
● based on rebasing
one master branch
● full & light
● master, develop, feature, hotfix and
release branches
● [optional] pull-requests - recommended
● all feature development in a
dedicated branch
● master branch will never
contain broken code
● feature-branches are merged
to master branch
● [optional] pull-requests
LIGHT HEAVY
● fork
● every developer has two
repositories - private local and
server-side public
● feature-branch with pull request
as added functionality/feedback
● popular on github libraries
where we do not have write
access to repository
● [required] pull-requests
images: atlassian
Gitflow workflow
Git-flow workflow:
● has two historical branches - master & develop
● feature branches
● release & maintenance branches
● based on merging
● git plugin is available on github (link)
● is derived from the work of Vincent Driessen (blog)
Historical
branches
● two branches to record history
● usually master & develop
● master is the release-only
branch with releases marked as
tags;
contains only release-ready code
● develop is the progression
branch into which cumulative
feature-branch funtionality is
merged
● when develop reaches a stable
state it is merged into master
master
develop
Feature
branches
● each new feature in its
own branch
● only complete, working
and tested features get
merged back to develop
● develop should be stable
so that other devs can
branch off it
Feature
develop
feature/a.b.c.functionality
Feature
branches
● synch work with rebasing
● either rebase all commits
which are not pushed or
branch off and rebase
entire local branch and
later cherry-pick changes
to feature without merge
Feature
Multiple devs work
on a single feature
develop
feature/a.b.c
develop
feature/a.b.c
feature/a.b.c.local
rebasing commits approach
origin/feature/a.b.c
Feature
branches
● synch work with rebasing
● either rebase all commits
which are not pushed or
branch off and rebase
entire local branch and
later cherry-pick changes
to feature without merge
Feature
Multiple devs work
on a single feature
develop
feature/a.b.c
feature/a.b.c.local
develop
feature/a.b.c
feature/a.b.c.local
local branch approach
Maintenance
& Release
Release
Release branches
● where development branch is
constantly changing and new feature
branches are often merged
● large teams, no feature-freeze?
● minor bug fixes, prepare meta-data for
release
● branch off from develop when develop
(almost) reflects the desired state
Maintenance
& Release
Maintenance branches
Maintenance
● “hotfix” branches
● the only branches which fork directly off of
master
● should be merged into both master and
develop
● quickly fix production releases
Summary
Git-flow workflow:
Git flow [...] advocates a master branch and a
separate develop branch. [...] [ There are ] supporting
branches for features, releases and hotfixes. The
development happens on the develop branch,
moves to a release branch and is finally merged
into the master branch.
source: http://gitlab.com
Pull requests
INTERACTION WITH OTHER DEVS
COMMUNICATION SKILLS
CLEAN DEVEL BRANCH
Issues with
gitflow
● gitflow seems too complex for simple projects
● release & hotfix branches seem redundant
(introduce complexity and are an overkill for most
projects)
● git log graph is crowded with paths
● alternative github-flow (link)
● alternative gitlab-flow (link)
Github-flow
Gitlab-flow
Github-flow Gitlab-flow
- master branch as main development branch
- new functionality merged via feature branches
straight to master
- master always ready to deploy
- add stable branches
like production, pre-production, release etc.
Merge vs rebase
Rebasing
Pros Cons
● easiest way to keep feature branch
up-to-date with a develop branch
● no redundant merges
● clean, however rewritten history
● easiest and clutter-free way of
working on a single shared branch
● merging preserves context
● rebasing pushed commits breaks
history for other developers
Merge vs rebase Rebasing
Git stash vs
temporary branches Temporary
branchKeeping temporary changes on local
branches:
● enables easy checkout/rebasing/
cherry picking/resetting between
branches and commits
● is way safer
● one can have multiple, visible on a
graph, temporary changes which
branch of in a specific point in
development
REMEMBER TO PRUNE TEMPORARY
BRANCHES REGULARLY!
Reflog
● enables EMERGENCY rollback of
deleted branches
● is GARBAGE COLLECTED
automatically (~30 days)
● or manually via git-gc command
● “inception” - revision to your
revisions
$ git reflog
$ git reset --hard ece080d
● always compile!
● contain single action/ functionality/
addition/ change
● be well described
Commit
granularity
Keeping well-maintained
granularity enables:
● easy rollback when you decide to
implement the feature differently
● easy cherry-picking of specific
functionality from a feature branch
(every commit is separate!)
● describes feature branch and its
contents without looking into the
files
● makes you safer - you can always
use reflog to go back to anything
you commited
A commit should:
Git desktop
clients
OS support:
● OS X
● Windows
PROS:
● Free of charge
● Git-flow native support
● very popular
CONS:
● no advanced features
Atlassian SourceTree
Git desktop
clients
OS support:
● OS X
● Windows
PROS:
● Free of charge
● Git-flow native support
CONS:
● no advanced features
Github desktop
Git desktop
clients
OS support:
● OS X
● Linux
● Windows
PROS:
● Free of charge for non-
commercial
● Git-flow support
● Pull-request on internal
repositories
● distributed reviews
● excellent git-hub integration
CONS:
● PAID for commercial
● appearance
SmartGit
Git desktop
clients
OS support:
● OS X
PROS:
● appearance
● excellent git-hub integration
● stage separate lines
● display changes in tree-view
● Git-flow support
● excellent search
● new-branch, merge by dragging
branches
● visual conflict resolution
CONS:
● PAID
Tower 2
Resources
RESOURCES:
● https://www.google.com/trends/explore#q=mercurial,git
● https://about.gitlab.com/2014/09/29/gitlab-flow/
● http://nvie.com/posts/a-successful-git-branching-model/
● https://guides.github.com/introduction/flow/
● https://leanpub.com/git-flow/read
Thankyou!
Bartosz Kosarzycki
bartosz.kosarzycki@stxnext.pl
@bkosarzycki

More Related Content

What's hot

Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 

What's hot (20)

Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Git branching strategies
Git branching strategiesGit branching strategies
Git branching strategies
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Git
GitGit
Git
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git basics
Git basicsGit basics
Git basics
 
Introduction git
Introduction gitIntroduction git
Introduction git
 

Similar to Git-flow workflow and pull-requests

Git Branching and Merging.pptx
Git Branching and Merging.pptxGit Branching and Merging.pptx
Git Branching and Merging.pptx
tapanvyas11
 

Similar to Git-flow workflow and pull-requests (20)

Git tips
Git tipsGit tips
Git tips
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
SFSCON23 - Yuri D'Elia - Automating git for development on large distributed ...
SFSCON23 - Yuri D'Elia - Automating git for development on large distributed ...SFSCON23 - Yuri D'Elia - Automating git for development on large distributed ...
SFSCON23 - Yuri D'Elia - Automating git for development on large distributed ...
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawanGit 101: Force-sensitive to Jedi padawan
Git 101: Force-sensitive to Jedi padawan
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
Microservices Development Process at Predix.io
Microservices Development Process at Predix.ioMicroservices Development Process at Predix.io
Microservices Development Process at Predix.io
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
 
Git Branching and Merging.pptx
Git Branching and Merging.pptxGit Branching and Merging.pptx
Git Branching and Merging.pptx
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Git+jenkins+rex presentation
Git+jenkins+rex presentationGit+jenkins+rex presentation
Git+jenkins+rex presentation
 
An intro to git
An intro to gitAn intro to git
An intro to git
 
Flow
FlowFlow
Flow
 
GITFlow definition for all software projects
GITFlow definition for all software projectsGITFlow definition for all software projects
GITFlow definition for all software projects
 

More from Bartosz Kosarzycki

ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developers
Bartosz Kosarzycki
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
Bartosz Kosarzycki
 

More from Bartosz Kosarzycki (18)

Droidcon Summary 2021
Droidcon Summary 2021Droidcon Summary 2021
Droidcon Summary 2021
 
Droidcon Online 2020 quick summary
Droidcon Online 2020 quick summaryDroidcon Online 2020 quick summary
Droidcon Online 2020 quick summary
 
Provider vs BLoC vs Redux
Provider vs BLoC vs ReduxProvider vs BLoC vs Redux
Provider vs BLoC vs Redux
 
Animations in Flutter
Animations in FlutterAnimations in Flutter
Animations in Flutter
 
Flutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for businessFlutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for business
 
Flutter CI & Device Farms for Flutter
Flutter CI & Device Farms for FlutterFlutter CI & Device Farms for Flutter
Flutter CI & Device Farms for Flutter
 
Drone racing - beginner's guide
Drone racing - beginner's guideDrone racing - beginner's guide
Drone racing - beginner's guide
 
Optimize apps for Chromebooks - Meet.Intive Oct, 2018
Optimize apps for Chromebooks - Meet.Intive Oct, 2018Optimize apps for Chromebooks - Meet.Intive Oct, 2018
Optimize apps for Chromebooks - Meet.Intive Oct, 2018
 
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47Android - Gradle build optimisation  3d83f31339d239abcc55f869e5f30348?s=47
Android - Gradle build optimisation 3d83f31339d239abcc55f869e5f30348?s=47
 
DroidCon Berlin 2018 summary
DroidCon Berlin 2018 summaryDroidCon Berlin 2018 summary
DroidCon Berlin 2018 summary
 
SCALA - Functional domain
SCALA -  Functional domainSCALA -  Functional domain
SCALA - Functional domain
 
Android things introduction - Development for IoT
Android things introduction - Development for IoTAndroid things introduction - Development for IoT
Android things introduction - Development for IoT
 
Daggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processorDaggerate your code - Write your own annotation processor
Daggerate your code - Write your own annotation processor
 
Android antipatterns
Android antipatternsAndroid antipatterns
Android antipatterns
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developers
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
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...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 

Git-flow workflow and pull-requests

  • 1. Git-flow & pull requests Bartosz Kosarzycki Apr 15, 2016
  • 2. Git-flow & pull requests AGENDA ❏ Git competition? ❏ Git workflows ❏ Gitflow workflow ❏ GF: Historical branches ❏ GF: Feature branches ❏ GF: Maintenance & Release branches ❏ Pull-requests ❏ Issues with gitflow ❏ Github-flow, git-lab flow ❏ Merge vs rebase ❏ Git stash vs temporary branches ❏ Reflog ❏ Commit granularity ❏ Comparison of git desktop clients
  • 3. Git competition ? ● mercurial is almost history ● main difference was better windows support in mercurial and discouraging rebasing as faking history of commits Stackoverflow: questions tagged7,103 68,906
  • 5. Workflows ● like SVN ● based on rebasing one master branch ● full & light ● master, develop, feature, hotfix and release branches ● [optional] pull-requests - recommended ● all feature development in a dedicated branch ● master branch will never contain broken code ● feature-branches are merged to master branch ● [optional] pull-requests LIGHT HEAVY ● fork ● every developer has two repositories - private local and server-side public ● feature-branch with pull request as added functionality/feedback ● popular on github libraries where we do not have write access to repository ● [required] pull-requests images: atlassian
  • 6. Gitflow workflow Git-flow workflow: ● has two historical branches - master & develop ● feature branches ● release & maintenance branches ● based on merging ● git plugin is available on github (link) ● is derived from the work of Vincent Driessen (blog)
  • 7. Historical branches ● two branches to record history ● usually master & develop ● master is the release-only branch with releases marked as tags; contains only release-ready code ● develop is the progression branch into which cumulative feature-branch funtionality is merged ● when develop reaches a stable state it is merged into master master develop
  • 8. Feature branches ● each new feature in its own branch ● only complete, working and tested features get merged back to develop ● develop should be stable so that other devs can branch off it Feature develop feature/a.b.c.functionality
  • 9. Feature branches ● synch work with rebasing ● either rebase all commits which are not pushed or branch off and rebase entire local branch and later cherry-pick changes to feature without merge Feature Multiple devs work on a single feature develop feature/a.b.c develop feature/a.b.c feature/a.b.c.local rebasing commits approach origin/feature/a.b.c
  • 10. Feature branches ● synch work with rebasing ● either rebase all commits which are not pushed or branch off and rebase entire local branch and later cherry-pick changes to feature without merge Feature Multiple devs work on a single feature develop feature/a.b.c feature/a.b.c.local develop feature/a.b.c feature/a.b.c.local local branch approach
  • 11. Maintenance & Release Release Release branches ● where development branch is constantly changing and new feature branches are often merged ● large teams, no feature-freeze? ● minor bug fixes, prepare meta-data for release ● branch off from develop when develop (almost) reflects the desired state
  • 12. Maintenance & Release Maintenance branches Maintenance ● “hotfix” branches ● the only branches which fork directly off of master ● should be merged into both master and develop ● quickly fix production releases
  • 13. Summary Git-flow workflow: Git flow [...] advocates a master branch and a separate develop branch. [...] [ There are ] supporting branches for features, releases and hotfixes. The development happens on the develop branch, moves to a release branch and is finally merged into the master branch. source: http://gitlab.com
  • 14. Pull requests INTERACTION WITH OTHER DEVS COMMUNICATION SKILLS CLEAN DEVEL BRANCH
  • 15. Issues with gitflow ● gitflow seems too complex for simple projects ● release & hotfix branches seem redundant (introduce complexity and are an overkill for most projects) ● git log graph is crowded with paths ● alternative github-flow (link) ● alternative gitlab-flow (link)
  • 16. Github-flow Gitlab-flow Github-flow Gitlab-flow - master branch as main development branch - new functionality merged via feature branches straight to master - master always ready to deploy - add stable branches like production, pre-production, release etc.
  • 17. Merge vs rebase Rebasing Pros Cons ● easiest way to keep feature branch up-to-date with a develop branch ● no redundant merges ● clean, however rewritten history ● easiest and clutter-free way of working on a single shared branch ● merging preserves context ● rebasing pushed commits breaks history for other developers
  • 18. Merge vs rebase Rebasing
  • 19. Git stash vs temporary branches Temporary branchKeeping temporary changes on local branches: ● enables easy checkout/rebasing/ cherry picking/resetting between branches and commits ● is way safer ● one can have multiple, visible on a graph, temporary changes which branch of in a specific point in development REMEMBER TO PRUNE TEMPORARY BRANCHES REGULARLY!
  • 20. Reflog ● enables EMERGENCY rollback of deleted branches ● is GARBAGE COLLECTED automatically (~30 days) ● or manually via git-gc command ● “inception” - revision to your revisions $ git reflog $ git reset --hard ece080d
  • 21. ● always compile! ● contain single action/ functionality/ addition/ change ● be well described Commit granularity Keeping well-maintained granularity enables: ● easy rollback when you decide to implement the feature differently ● easy cherry-picking of specific functionality from a feature branch (every commit is separate!) ● describes feature branch and its contents without looking into the files ● makes you safer - you can always use reflog to go back to anything you commited A commit should:
  • 22. Git desktop clients OS support: ● OS X ● Windows PROS: ● Free of charge ● Git-flow native support ● very popular CONS: ● no advanced features Atlassian SourceTree
  • 23. Git desktop clients OS support: ● OS X ● Windows PROS: ● Free of charge ● Git-flow native support CONS: ● no advanced features Github desktop
  • 24. Git desktop clients OS support: ● OS X ● Linux ● Windows PROS: ● Free of charge for non- commercial ● Git-flow support ● Pull-request on internal repositories ● distributed reviews ● excellent git-hub integration CONS: ● PAID for commercial ● appearance SmartGit
  • 25. Git desktop clients OS support: ● OS X PROS: ● appearance ● excellent git-hub integration ● stage separate lines ● display changes in tree-view ● Git-flow support ● excellent search ● new-branch, merge by dragging branches ● visual conflict resolution CONS: ● PAID Tower 2
  • 26. Resources RESOURCES: ● https://www.google.com/trends/explore#q=mercurial,git ● https://about.gitlab.com/2014/09/29/gitlab-flow/ ● http://nvie.com/posts/a-successful-git-branching-model/ ● https://guides.github.com/introduction/flow/ ● https://leanpub.com/git-flow/read