SlideShare a Scribd company logo
1 of 29
My Git WorkFlow
The GitHub Patterns

Rui Carvalho
@rhwy
The origin of the problem

How code lives

@rhwy // Rui Carvalho
lifecycle
New Features
New Features

Projects and
code evolve
with time

Bug Fix
In Production

Testing Next
Version

@rhwy // Rui Carvalho

Troubles !
Solutions ?

How people code

@rhwy // Rui Carvalho
Classic VCS Habits
•
•
•
•
•
•

Do a project “Long running” branch
Continue that ugly coding
Pray to be the first to merge
Deploy monthly to avoid conflicts
Iterate for X years (average 5?)
Big bang the project and create a new
VCS root

@rhwy // Rui Carvalho
Sounds good ?

@rhwy // Rui Carvalho
Should I care ?

Source Code

@rhwy // Rui Carvalho
Code Matters!
• Your code and your VCS are your only
valid documentation
• Your code is living and your VCS is the
open book of that History

@rhwy // Rui Carvalho
Keep calm and code

Rules

@rhwy // Rui Carvalho
Objectives ?
• Always be able to build a production
version
• Always be able to build a stable version
• Easily integrate new features
• Avoid long term “out of space” code (aka
project branches)
• Produce Value on each commit
@rhwy // Rui Carvalho
Simple model

git branch

@rhwy // Rui Carvalho
Small branches
•
•
•
•
•

Very small branches
Keep central repository clean
Work localy then push your branch
Someone else review & merge
Update your master

@rhwy // Rui Carvalho
Small branches
• No learning curve
• Near classic VCS patterns
– But, better isolation
– Easier, due to no-cost branching

• Work remotely
• No side effects

@rhwy // Rui Carvalho
Distant
merge

4

Project A
master

1

clone

Project A
Small_work

pull 5

push 3
6
rebase

Project A
master

2 branch

Local

Project A
Small_work
//2 step branching
$> git branch “create_login_box”
$> git checkout create_login_box

//1 command branching
$> git checkout –b create_login_box

Create Branch, then Checkout
$>
$>
$>
$>
$>

//add files, do some code
git add loginViewModel.cs
git commit –m “created view model for login”
//more core, finish
git commit –m “created html login UI”

//then push your branch with that commits
$> git push origin create_login_box

Code, Add to index, Commit, push branch
$> //on the remote repo
$> git checkout master
$> git create_login_box
$> //on your box, sync the master from remote
$> git pull origin master

Someone merge,
then you can update your local master
$>
it
$>
$>

//if you need to continue on the repo, sync
with the updated master
git checkout create_login_box
git rebase master

$> //if not delete it
$> git branch –d create_login_box

Then continue your work,
Or simply delete your branch
A better model

git fork

@rhwy // Rui Carvalho
Fork what?
•
•
•
•
•

Protect your central repository
Restrict rights, accept external work
Your branches, your mess
Your own builds, easier team work
Not git, but quite all online services
support it
– = clone on server side

@rhwy // Rui Carvalho
Other benefits
•
•
•
•

Easier remote work
YOU, sure to always have a clean master
Easier code review across teams
It opens a discussion

@rhwy // Rui Carvalho
Distant
1 Fork

Team Account
ProjectA repository
6

master

merge

Upstream

branch1

pull
Request
branch1
5

My Account
ProjectA repository

Origin
8
Push origin
master

2
clone
7
pull
Upstream
master

branch1

master

My Account

ProjectA repository
3

master

Local

branch

branch1

9
Rebase / delete

4
Push
Origin
branch1
$> //remotely:
$> //fork it/clone it on the server side from
company/projectA to myaccount/projectA
$> //locally:
$> git clone myrepo/projectA
$> git checkout –b my_feature

1. Fork, clone & branch
$> git add myfile
$> git commit –m “I added some value”
$> git push origin my_feature

2. Work, add, commit, push origin
$> //remotely:
$> //pull request : ask to push your branch
my_feature from myaccount/projectA to
company/projectA
$> //then merge on company/projectA
account(probably someone else)
$> //locally:
$> //update your master with the merged one
$> git pull upstream master

3.Pull request, merge, re-sync
$> //locally
$> //to be sure to always have a clean master
available everywher, you need to update it
$> git push origin master
$>
$>
$>
$>
$>
$>

//continue to work
git checkout my_feature
//sync your branch from updated master
git rebase master
//if not delete it
git branch –d create_login_box

Then, update your remote fork,
And continue your work,
Or simply delete your branch
Better code, more fun

Github workflow style

@rhwy // Rui Carvalho
Practice, practice, practice

Want to be a Ninja?

@rhwy // Rui Carvalho
Keep

In
touch

@rhwy
Codedistillers.com

rui.fr
github.com/rhwy

Octocats:
http://octodex.github.com/
A references:
http://nvie.com/posts/a-successful-git-branching-model/
https://github.com/NancyFx/Nancy/blob/master/CONTRIBUTING.md

More Related Content

What's hot

40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
Ruben Tan
 

What's hot (20)

Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 
Gitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de BranchesGitflow - Una metología para manejo de Branches
Gitflow - Una metología para manejo de Branches
 
Pull Request (PR): A git workflow
Pull Request (PR): A git workflow Pull Request (PR): A git workflow
Pull Request (PR): A git workflow
 
Pubmi gitflow
Pubmi gitflowPubmi gitflow
Pubmi gitflow
 
Collaborative development with git
Collaborative development with gitCollaborative development with git
Collaborative development with git
 
Gitflow Workflow
Gitflow WorkflowGitflow Workflow
Gitflow Workflow
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
The gitflow way
The gitflow wayThe gitflow way
The gitflow way
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
 
Git in Continuous Deployment
Git in Continuous DeploymentGit in Continuous Deployment
Git in Continuous Deployment
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams
 
Git workflow in agile development
Git workflow in agile developmentGit workflow in agile development
Git workflow in agile development
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
Serving Pull Requests with Jenkins
Serving Pull Requests with JenkinsServing Pull Requests with Jenkins
Serving Pull Requests with Jenkins
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHub
 
Composer and Git in Magento
Composer and Git in MagentoComposer and Git in Magento
Composer and Git in Magento
 
Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)
 

Viewers also liked

Git workflows
Git workflowsGit workflows
Git workflows
Xpand IT
 
Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017
WhatConts
 
BPM & Enterprise Middleware - Datasheet
BPM & Enterprise Middleware - DatasheetBPM & Enterprise Middleware - Datasheet
BPM & Enterprise Middleware - Datasheet
Xpand IT
 

Viewers also liked (20)

Git workflows
Git workflowsGit workflows
Git workflows
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
GitHub Talk - Cody Carnachan
GitHub Talk - Cody CarnachanGitHub Talk - Cody Carnachan
GitHub Talk - Cody Carnachan
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
The development workflow of git github for beginners
The development workflow of git github for beginnersThe development workflow of git github for beginners
The development workflow of git github for beginners
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Git workflows
Git workflowsGit workflows
Git workflows
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Introduction Pentaho 5.0
Introduction Pentaho 5.0 Introduction Pentaho 5.0
Introduction Pentaho 5.0
 
Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017
 
Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015
 
BPM & Enterprise Middleware - Datasheet
BPM & Enterprise Middleware - DatasheetBPM & Enterprise Middleware - Datasheet
BPM & Enterprise Middleware - Datasheet
 
Challenges in opening up qualitative research data
Challenges in opening up qualitative research dataChallenges in opening up qualitative research data
Challenges in opening up qualitative research data
 

Similar to My Git workflow

[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code
Christopher Schmitt
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 

Similar to My Git workflow (20)

Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
Esri open source projects on GitHub
Esri open source projects on GitHubEsri open source projects on GitHub
Esri open source projects on GitHub
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Git
GitGit
Git
 
[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code
 
Hacking on WildFly 9
Hacking on WildFly 9Hacking on WildFly 9
Hacking on WildFly 9
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-public
 
Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017Habitat Workshop at Velocity London 2017
Habitat Workshop at Velocity London 2017
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatterns
 
Hacking on WildFly 9
Hacking on WildFly 9Hacking on WildFly 9
Hacking on WildFly 9
 
CICD_1670665418.pdf
CICD_1670665418.pdfCICD_1670665418.pdf
CICD_1670665418.pdf
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Git presentation
Git presentationGit presentation
Git presentation
 

More from Rui Carvalho

More from Rui Carvalho (15)

Agile Feedback Loops
Agile Feedback LoopsAgile Feedback Loops
Agile Feedback Loops
 
NewCrafts 2017 Conference Opening
NewCrafts 2017 Conference OpeningNewCrafts 2017 Conference Opening
NewCrafts 2017 Conference Opening
 
Cqrs Ignite
Cqrs IgniteCqrs Ignite
Cqrs Ignite
 
AltNet fr talks #2016.11 - news
AltNet fr talks #2016.11 - newsAltNet fr talks #2016.11 - news
AltNet fr talks #2016.11 - news
 
Patience, the art of taking his time
Patience, the art of taking his timePatience, the art of taking his time
Patience, the art of taking his time
 
Ncrafts 2016 opening notes
Ncrafts 2016 opening notesNcrafts 2016 opening notes
Ncrafts 2016 opening notes
 
Code Cooking
Code Cooking Code Cooking
Code Cooking
 
Clean up your code with C#6
Clean up your code with C#6Clean up your code with C#6
Clean up your code with C#6
 
Feedback Loops v4x3 Lightening
Feedback Loops v4x3 Lightening Feedback Loops v4x3 Lightening
Feedback Loops v4x3 Lightening
 
Feedback Loops...to infinity, and beyond!
Feedback Loops...to infinity, and beyond!Feedback Loops...to infinity, and beyond!
Feedback Loops...to infinity, and beyond!
 
Simple Code
Simple CodeSimple Code
Simple Code
 
Simplicity 2.0 - Get the power back
Simplicity 2.0 - Get the power backSimplicity 2.0 - Get the power back
Simplicity 2.0 - Get the power back
 
SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)SPA avec Angular et SignalR (FR)
SPA avec Angular et SignalR (FR)
 
Simplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and toolsSimplicity - develop modern web apps with tiny frameworks and tools
Simplicity - develop modern web apps with tiny frameworks and tools
 
.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?.Net pour le développeur Java - une source d'inspiration?
.Net pour le développeur Java - une source d'inspiration?
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

My Git workflow

Editor's Notes

  1. This Talk is about common git workflows that most people use and targets people still using standard VCS (cvs, svn, tfs…) in their company.
  2. Code is living and at every moment, depending on the project size, the team size, the project age and many other factors, you need to have different “versions” of you code available