SlideShare une entreprise Scribd logo
1  sur  49
Introduction to
Git
@parallelit
(part 3)
Agenda
• Branching
• Merging
• Gitflow Workflow
• GitHub Flow
• Pull request
What is a branch?
A branch represents an independent line of
development.
What is a merge?
Join two or more development histories together.
Git in action
Gitflow Workflow
The Gitflow Workflow is derived from Vincent
Driessen at nvie.
He wrote a post on his blog “A successful Git
branching model”. You can read it on http://nvie.com/
posts/a-successful-git-branching-model/
The Gitflow Workflow defines a strict branching
model designed around the project release.
Gitflow Workflow is a robust framework for managing
larger projects.
The main branches
The central repo holds two historical branches
with an infinite lifetime:
• master
• develop
master
The master branch at origin should be familiar to
every Git user.
We consider origin/master to be the main branch
where the source code of HEAD always reflects a
production-ready state.
develop
Parallel to the master branch, another branch exists called
develop.
We consider origin/develop to be the main branch where the
source code of HEAD always reflects a state with the latest
delivered development changes for the next release. Some
would call this the “integration branch”.
This is where any automatic nightly builds are built from.
When the source code in the 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.
Supporting branches
The different types of branches we may use are:
• Feature branches
• Release branches
• Hotfix branches
Each of these branches have a specific purpose and
are bound to strict rules as to which branches may
be their originating branch and which branches must
be their merge targets.
Feature branches (1)
May branch off from develop
Must merge back into develop
Branch naming convention: anything except
master, develop, release-*, or hotfix-*
Feature branches (2)
Feature branches are sometimes called topic
branches.
They are used to develop new features for the
upcoming or a distant future release.
Feature branches typically exist in developer
repos only, not in origin.
Feature branches (3)
Finished features may be merged into the develop
branch using the --no-ff flag.
This causes the merge to always create a new
commit object, even if the merge could be
performed with a fast-forward.
This avoids losing information about the historical
existence of a feature branch and groups together
all commits that together added the feature.
Release branches (1)
May branch off from develop
Must merge back into
develop
master
Branch naming convention: release-*
Tag: increment major or minor number
Release branches (2)
Release branches support preparation of a new
production release. They allow for last-minute
dotting of i’s and crossing t’s. Furthermore, they
allow for minor bug fixes and preparing meta-data
for a release (version number, build dates, etc.).
By doing all of this work on a release branch, the
develop branch is cleared to receive features for
the next big release.
Release branches (3)
The key moment to branch off a new release
branch from develop is when develop (almost)
reflects the desired state of the new release.
It is exactly at the start of a release branch that
the upcoming release gets assigned a version
number, not any earlier. Up until that moment, the
develop branch reflected changes for the “next
release”, but it is unclear whether that “next
release” until the release branch is started.
Hotfix branches (1)
May branch off from master
Must merge back into
develop
master
Branch naming convention: hotfix-*
Hotfix branches (2)
Hotfix branches are very much like release branches in that
they are also meant to prepare for a new production release,
albeit unplanned. They arise from the necessity to act
immediately upon an undesired state of a live production
version.
When a critical bug in a production version must be resolved
immediately, a hotfix branch may be branched off from the
corresponding tag on the master branch that marks the
production version.
The essence is that work of team members (on the develop
branch) can continue, while another person is preparing a
quick production fix.
Hotfix branches (3)
There is one exception to the merge rule, when a
release branch currently exists, the hotfix
changes need to be merged into that release
branch, instead of develop.
Back-merging the bugfix into the release branch
will eventually result in the bugfix being merged
into develop too, when the release branch is
finished.
Branches
branch number of branches
may be removed
after merge
master once forever never
develop once forever never
feature many at the same time —
release-name once at the same time yes
hotfix-name once at the same time yes
Git in action
GitHub Flow (1)
GitHub Flow (2)
GitHub Flow is a lightweight, branch-based
workflow that supports teams and projects where
deployments are made regularly.
Where regularly means teams deploy to
production every day, often several times a day
(Continuous Integration is required).
What is GitHub Flow? (1)
It is based on 6 simple rules:
(1) Anything in the master branch is deployable;
(2) To work on something new, create a
descriptively named branch off of master (ie:
suggested-channels);
(3) Commit to that branch locally and regularly
push your work to the same named branch on the
server;
What is GitHub Flow? (2)
It is based on 6 simple rules:
(4) When you need feedback or help, or you think
the branch is ready for merging, open a pull
request;
(5) After someone else has reviewed and signed
off on the feature, you can merge it into master;
(6) Once it is merged and pushed to “master”, you
can and should deploy immediately.
#1 Anything in the master
branch is deployable
This is basically the only hard rule of the system.
There is only one branch that has any specific and
consistent meaning and we named it master.
It’s incredibly rare that this gets rewound (the
branch is moved back to an older commit to revert
work). If there is an issue, commits will be
reverted or new commits will be introduced that
fixes the issue, but the branch itself is almost
never rolled back.
#1 Anything in the master
branch is deployable
The master branch is stable and it is always safe to
deploy from it or create new branches off of it.
If you push something to master that is not tested or
breaks the build, you break the social contract of the
development team. Every branch we push has tests
run on it and reported to the team, so if you haven’t run
them locally, you can simply push to a topic branch.
You could have a deployed branch that is updated only
when you deploy, but we don’t do that. We simply
expose the currently deployed SHA.
#2 Create descriptive
branches off of master
When you want to start work on anything, you
create a descriptively named branch off of the
stable master branch.
This has several advantages: one is that when
you fetch, you can see the topics that everyone
else has been working on. Another is that if you
abandon a branch for a while and go back to it
later, it’s fairly easy to remember what it was.
#3 Push to named branches
constantly
Another big difference from git-flow is that we
push to named branches on the server constantly.
Since the only thing we really have to worry about
is master from a deployment standpoint, pushing
to the server doesn’t mess anyone up or confuse
things, everything that is not master is simply
something being worked on.
It also make sure that our work is always backed
up in case of laptop loss or hard drive failure.
#4 Open a pull request at any
time
GitHub has an amazing code review system called pull
requests.
GitHub Flow uses the pull requests to review the code
long before you actually want to merge it into master for
deployment.
If you are stuck in the progress of your feature or branch
and need help or advice, or if you are a developer and
need a designer to review your work (or vice versa), or
even if you have little or no code but some screenshot
comps or general ideas, you open a pull request.
#5 Merge only after pull
request review
We don’t simply do work directly on master or
work on a topic branch and merge it in when we
think it’s done. We try to get signoff from
someone else in the company. This is generally a
+1 or emoji or “:shipit:” comment.
Once we get that, and the branch passes CI, we
can merge it into master for deployment, which
will automatically close the pull request when we
push it.
#6 Deploy immediately after
review
Finally, your work is done and merged into the
master branch. This means that even if you don’t
deploy it now, people will base new work off of it
and the next deploy, which will likely happen in a
few hours, will push it out. So since you really
don’t want someone else to push something that
you wrote that breaks things, people tend to make
sure that it really is stable when it’s merged and
people also tend to push their own changes.
X
Create a branch
X
Add commits
X
Open pull request
X
Discuss and review your code
X
Deploy
X
Merge
Pull request (1)
Pull requests are a feature that makes it easier for
developers to collaborate.
In their simplest form, pull requests are a
mechanism for a developer to notify team members
that they have completed a feature. Once their
feature branch is ready, the developer files a pull
request.
This lets everybody involved know that they need to
review the code and merge it into the master branch.
Pull request (2)
But, the pull request
is more than just a
notification. It’s a
dedicated forum for
discussing the
proposed feature. If
there are any
problems with the
changes,
teammates can post feedback in the pull request and
even tweak the feature by pushing follow-up
commits. All of this activity is tracked directly inside
of the pull request.
What is a pull request?
When you file a pull request, all you’re doing is requesting
that another developer pulls a branch from your repository
into their repository.
This means that you need to provide 4 pieces of information
to file a pull request:
• source repository
• source branch
• destination repository
• destination branch
Look out
A pull request requires either two distinct
branches or two distinct repositories.
A pull request using Bitbucket
This is the most simple Workflow:
• A developer creates the feature in a dedicated branch in their
local repo.
• The developer pushes the branch to a public Bitbucket
repository.
• The developer files a pull request via Bitbucket.
• The rest of the team reviews the code, discusses it, and alters
it.
• The project maintainer merges the feature into the official
repository and closes the pull request.
Accept a pull request
Only a user with write permissions on the
destination repository can accept or reject a pull
request. Any user with read permission in a
repository can review the open, accepted and
rejected pull requests.
Decline a pull request
Declining a pull request cannot be undone. Once
you decline a pull request you will have to open a
new pull request request to continue a review.
Declining a pull request has no effect on the
branches (source or destination) so the changes
in the source branch are still in that source
branch.
Git in action
http://sal.va.it/1O8paVy
Download these slides on

Contenu connexe

Tendances

Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2Mike Willbanks
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflowRuben Tan
 
Devops interview questions 1 www.bigclasses.com
Devops interview questions  1  www.bigclasses.comDevops interview questions  1  www.bigclasses.com
Devops interview questions 1 www.bigclasses.combigclasses.com
 
Devops interview questions 2 www.bigclasses.com
Devops interview questions  2  www.bigclasses.comDevops interview questions  2  www.bigclasses.com
Devops interview questions 2 www.bigclasses.combigclasses.com
 
02-version control(DevOps Series)
02-version control(DevOps Series)02-version control(DevOps Series)
02-version control(DevOps Series)Mohammed Shaban
 
03.13.13 WANDisco SVN Training: Advanced Branching & Merging
03.13.13 WANDisco SVN Training: Advanced Branching & Merging03.13.13 WANDisco SVN Training: Advanced Branching & Merging
03.13.13 WANDisco SVN Training: Advanced Branching & MergingWANdisco Plc
 
基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構玄武 Wu
 
SCM Harmony: git & Github for Sony Teams
SCM Harmony: git & Github for Sony TeamsSCM Harmony: git & Github for Sony Teams
SCM Harmony: git & Github for Sony TeamsJames Womack
 
How we git - commit policy and code review
How we git - commit policy and code reviewHow we git - commit policy and code review
How we git - commit policy and code reviewRuben Tan
 
Trunk based development for Beginners
Trunk based development for BeginnersTrunk based development for Beginners
Trunk based development for BeginnersNebulaworks
 
SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8Rajwinder Singh
 
JPQL/ JPA Activity 1
JPQL/ JPA Activity 1JPQL/ JPA Activity 1
JPQL/ JPA Activity 1SFI
 
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012msohn
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.usjclingan
 

Tendances (18)

Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
 
40 square's git workflow
40 square's git workflow40 square's git workflow
40 square's git workflow
 
Devops interview questions 1 www.bigclasses.com
Devops interview questions  1  www.bigclasses.comDevops interview questions  1  www.bigclasses.com
Devops interview questions 1 www.bigclasses.com
 
Devops interview questions 2 www.bigclasses.com
Devops interview questions  2  www.bigclasses.comDevops interview questions  2  www.bigclasses.com
Devops interview questions 2 www.bigclasses.com
 
02-version control(DevOps Series)
02-version control(DevOps Series)02-version control(DevOps Series)
02-version control(DevOps Series)
 
Git Standards
Git StandardsGit Standards
Git Standards
 
03.13.13 WANDisco SVN Training: Advanced Branching & Merging
03.13.13 WANDisco SVN Training: Advanced Branching & Merging03.13.13 WANDisco SVN Training: Advanced Branching & Merging
03.13.13 WANDisco SVN Training: Advanced Branching & Merging
 
基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構基於 Flow & Path 的 MVP 架構
基於 Flow & Path 的 MVP 架構
 
SCM Harmony: git & Github for Sony Teams
SCM Harmony: git & Github for Sony TeamsSCM Harmony: git & Github for Sony Teams
SCM Harmony: git & Github for Sony Teams
 
Git essentials
Git essentialsGit essentials
Git essentials
 
How we git - commit policy and code review
How we git - commit policy and code reviewHow we git - commit policy and code review
How we git - commit policy and code review
 
TibcoBW6.0
TibcoBW6.0TibcoBW6.0
TibcoBW6.0
 
Trunk based development for Beginners
Trunk based development for BeginnersTrunk based development for Beginners
Trunk based development for Beginners
 
SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8
 
Getting Git
Getting GitGetting Git
Getting Git
 
JPQL/ JPA Activity 1
JPQL/ JPA Activity 1JPQL/ JPA Activity 1
JPQL/ JPA Activity 1
 
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
 
MicroProfile Devoxx.us
MicroProfile Devoxx.usMicroProfile Devoxx.us
MicroProfile Devoxx.us
 

Similaire à Introduction to Git (part 3)

Source code management with Git
Source code management with GitSource code management with Git
Source code management with GitRadu Barbu
 
A Git MVP Workflow
A Git MVP WorkflowA Git MVP Workflow
A Git MVP WorkflowBurt Lum
 
CS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdfCS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdfalbusfons939393
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testersupadhyay_25
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 
[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 GitIvano Malavolta
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01Gourav Varma
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01Gourav Varma
 
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
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow WorkshopSyed Imam
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
CoDe:U git flow
CoDe:U git flowCoDe:U git flow
CoDe:U git flowLars Kruse
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 
Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 

Similaire à Introduction to Git (part 3) (20)

Source code management with Git
Source code management with GitSource code management with Git
Source code management with Git
 
A Git MVP Workflow
A Git MVP WorkflowA Git MVP Workflow
A Git MVP Workflow
 
CS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdfCS_Note_Introduction to Git Workflow.pdf
CS_Note_Introduction to Git Workflow.pdf
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
[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
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Git
GitGit
Git
 
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
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Git flow
Git flowGit flow
Git flow
 
git Technologies
git Technologiesgit Technologies
git Technologies
 
CoDe:U git flow
CoDe:U git flowCoDe:U git flow
CoDe:U git flow
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
E caregitpresentation
E caregitpresentationE caregitpresentation
E caregitpresentation
 
Git for developers
Git for developersGit for developers
Git for developers
 
Gitflow Workflow
Gitflow WorkflowGitflow Workflow
Gitflow Workflow
 

Plus de Salvatore Cordiano

Transformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelTransformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelSalvatore Cordiano
 
Executive Master in Business Administration
Executive Master in Business AdministrationExecutive Master in Business Administration
Executive Master in Business AdministrationSalvatore Cordiano
 
Facile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedFacile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedSalvatore Cordiano
 
Accrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviAccrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviSalvatore Cordiano
 
Migliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriMigliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriSalvatore Cordiano
 
Delivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksDelivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksSalvatore Cordiano
 
No Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringNo Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringSalvatore Cordiano
 
Facile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedFacile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedSalvatore Cordiano
 
FP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonyFP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonySalvatore Cordiano
 
Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Salvatore Cordiano
 
The Blake Mouton Managerial Grid
The Blake Mouton Managerial GridThe Blake Mouton Managerial Grid
The Blake Mouton Managerial GridSalvatore Cordiano
 
Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Salvatore Cordiano
 

Plus de Salvatore Cordiano (20)

Transformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating ModelTransformed: Moving to the Product Operating Model
Transformed: Moving to the Product Operating Model
 
Executive Master in Business Administration
Executive Master in Business AdministrationExecutive Master in Business Administration
Executive Master in Business Administration
 
Facile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learnedFacile.it Partner 🚀 Hackathon 2023 - What we learned
Facile.it Partner 🚀 Hackathon 2023 - What we learned
 
Accrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettiviAccrescere la motivazione per raggiungere gli obiettivi
Accrescere la motivazione per raggiungere gli obiettivi
 
Il potere delle domande
Il potere delle domandeIl potere delle domande
Il potere delle domande
 
Impara a delegare
Impara a delegareImpara a delegare
Impara a delegare
 
Migliora il tuo ascolto
Migliora il tuo ascoltoMigliora il tuo ascolto
Migliora il tuo ascolto
 
Negoziazione organizzativa
Negoziazione organizzativaNegoziazione organizzativa
Negoziazione organizzativa
 
Migliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratoriMigliora le prestazioni dei tuoi collaboratori
Migliora le prestazioni dei tuoi collaboratori
 
Charles Péguy - Il denaro
Charles Péguy - Il denaroCharles Péguy - Il denaro
Charles Péguy - Il denaro
 
Delivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP TalksDelivering Effective Feedback - FP Talks
Delivering Effective Feedback - FP Talks
 
No Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software EngineeringNo Silver Bullet - Essence and Accident in Software Engineering
No Silver Bullet - Essence and Accident in Software Engineering
 
Facile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learnedFacile.it Partner Hackathon - What we learned
Facile.it Partner Hackathon - What we learned
 
FP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremonyFP Hackathon - Closing, remarks and awards ceremony
FP Hackathon - Closing, remarks and awards ceremony
 
Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022Facile.it Partner Hackathon 2022
Facile.it Partner Hackathon 2022
 
Remarks about Ownership
Remarks about OwnershipRemarks about Ownership
Remarks about Ownership
 
Introducing Kaizen
Introducing KaizenIntroducing Kaizen
Introducing Kaizen
 
Introducing Eisenhower Matrix
Introducing Eisenhower MatrixIntroducing Eisenhower Matrix
Introducing Eisenhower Matrix
 
The Blake Mouton Managerial Grid
The Blake Mouton Managerial GridThe Blake Mouton Managerial Grid
The Blake Mouton Managerial Grid
 
Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)Facile.it Partner Hackathon (kick-off)
Facile.it Partner Hackathon (kick-off)
 

Dernier

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 

Dernier (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 

Introduction to Git (part 3)

  • 2. Agenda • Branching • Merging • Gitflow Workflow • GitHub Flow • Pull request
  • 3. What is a branch? A branch represents an independent line of development.
  • 4. What is a merge? Join two or more development histories together.
  • 6. Gitflow Workflow The Gitflow Workflow is derived from Vincent Driessen at nvie. He wrote a post on his blog “A successful Git branching model”. You can read it on http://nvie.com/ posts/a-successful-git-branching-model/ The Gitflow Workflow defines a strict branching model designed around the project release. Gitflow Workflow is a robust framework for managing larger projects.
  • 7. The main branches The central repo holds two historical branches with an infinite lifetime: • master • develop
  • 8.
  • 9. master The master branch at origin should be familiar to every Git user. We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.
  • 10. develop Parallel to the master branch, another branch exists called develop. We consider origin/develop to be the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release. Some would call this the “integration branch”. This is where any automatic nightly builds are built from. When the source code in the 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.
  • 11. Supporting branches The different types of branches we may use are: • Feature branches • Release branches • Hotfix branches Each of these branches have a specific purpose and are bound to strict rules as to which branches may be their originating branch and which branches must be their merge targets.
  • 12. Feature branches (1) May branch off from develop Must merge back into develop Branch naming convention: anything except master, develop, release-*, or hotfix-*
  • 13. Feature branches (2) Feature branches are sometimes called topic branches. They are used to develop new features for the upcoming or a distant future release. Feature branches typically exist in developer repos only, not in origin.
  • 14. Feature branches (3) Finished features may be merged into the develop branch using the --no-ff flag. This causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward. This avoids losing information about the historical existence of a feature branch and groups together all commits that together added the feature.
  • 15.
  • 16. Release branches (1) May branch off from develop Must merge back into develop master Branch naming convention: release-* Tag: increment major or minor number
  • 17. Release branches (2) Release branches support preparation of a new production release. They allow for last-minute dotting of i’s and crossing t’s. Furthermore, they allow for minor bug fixes and preparing meta-data for a release (version number, build dates, etc.). By doing all of this work on a release branch, the develop branch is cleared to receive features for the next big release.
  • 18. Release branches (3) The key moment to branch off a new release branch from develop is when develop (almost) reflects the desired state of the new release. It is exactly at the start of a release branch that the upcoming release gets assigned a version number, not any earlier. Up until that moment, the develop branch reflected changes for the “next release”, but it is unclear whether that “next release” until the release branch is started.
  • 19. Hotfix branches (1) May branch off from master Must merge back into develop master Branch naming convention: hotfix-*
  • 20. Hotfix branches (2) Hotfix branches are very much like release branches in that they are also meant to prepare for a new production release, albeit unplanned. They arise from the necessity to act immediately upon an undesired state of a live production version. When a critical bug in a production version must be resolved immediately, a hotfix branch may be branched off from the corresponding tag on the master branch that marks the production version. The essence is that work of team members (on the develop branch) can continue, while another person is preparing a quick production fix.
  • 21. Hotfix branches (3) There is one exception to the merge rule, when a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop. Back-merging the bugfix into the release branch will eventually result in the bugfix being merged into develop too, when the release branch is finished.
  • 22. Branches branch number of branches may be removed after merge master once forever never develop once forever never feature many at the same time — release-name once at the same time yes hotfix-name once at the same time yes
  • 25. GitHub Flow (2) GitHub Flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly. Where regularly means teams deploy to production every day, often several times a day (Continuous Integration is required).
  • 26. What is GitHub Flow? (1) It is based on 6 simple rules: (1) Anything in the master branch is deployable; (2) To work on something new, create a descriptively named branch off of master (ie: suggested-channels); (3) Commit to that branch locally and regularly push your work to the same named branch on the server;
  • 27. What is GitHub Flow? (2) It is based on 6 simple rules: (4) When you need feedback or help, or you think the branch is ready for merging, open a pull request; (5) After someone else has reviewed and signed off on the feature, you can merge it into master; (6) Once it is merged and pushed to “master”, you can and should deploy immediately.
  • 28. #1 Anything in the master branch is deployable This is basically the only hard rule of the system. There is only one branch that has any specific and consistent meaning and we named it master. It’s incredibly rare that this gets rewound (the branch is moved back to an older commit to revert work). If there is an issue, commits will be reverted or new commits will be introduced that fixes the issue, but the branch itself is almost never rolled back.
  • 29. #1 Anything in the master branch is deployable The master branch is stable and it is always safe to deploy from it or create new branches off of it. If you push something to master that is not tested or breaks the build, you break the social contract of the development team. Every branch we push has tests run on it and reported to the team, so if you haven’t run them locally, you can simply push to a topic branch. You could have a deployed branch that is updated only when you deploy, but we don’t do that. We simply expose the currently deployed SHA.
  • 30. #2 Create descriptive branches off of master When you want to start work on anything, you create a descriptively named branch off of the stable master branch. This has several advantages: one is that when you fetch, you can see the topics that everyone else has been working on. Another is that if you abandon a branch for a while and go back to it later, it’s fairly easy to remember what it was.
  • 31. #3 Push to named branches constantly Another big difference from git-flow is that we push to named branches on the server constantly. Since the only thing we really have to worry about is master from a deployment standpoint, pushing to the server doesn’t mess anyone up or confuse things, everything that is not master is simply something being worked on. It also make sure that our work is always backed up in case of laptop loss or hard drive failure.
  • 32. #4 Open a pull request at any time GitHub has an amazing code review system called pull requests. GitHub Flow uses the pull requests to review the code long before you actually want to merge it into master for deployment. If you are stuck in the progress of your feature or branch and need help or advice, or if you are a developer and need a designer to review your work (or vice versa), or even if you have little or no code but some screenshot comps or general ideas, you open a pull request.
  • 33. #5 Merge only after pull request review We don’t simply do work directly on master or work on a topic branch and merge it in when we think it’s done. We try to get signoff from someone else in the company. This is generally a +1 or emoji or “:shipit:” comment. Once we get that, and the branch passes CI, we can merge it into master for deployment, which will automatically close the pull request when we push it.
  • 34. #6 Deploy immediately after review Finally, your work is done and merged into the master branch. This means that even if you don’t deploy it now, people will base new work off of it and the next deploy, which will likely happen in a few hours, will push it out. So since you really don’t want someone else to push something that you wrote that breaks things, people tend to make sure that it really is stable when it’s merged and people also tend to push their own changes.
  • 38. X Discuss and review your code
  • 41. Pull request (1) Pull requests are a feature that makes it easier for developers to collaborate. In their simplest form, pull requests are a mechanism for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request. This lets everybody involved know that they need to review the code and merge it into the master branch.
  • 42. Pull request (2) But, the pull request is more than just a notification. It’s a dedicated forum for discussing the proposed feature. If there are any problems with the changes, teammates can post feedback in the pull request and even tweak the feature by pushing follow-up commits. All of this activity is tracked directly inside of the pull request.
  • 43. What is a pull request? When you file a pull request, all you’re doing is requesting that another developer pulls a branch from your repository into their repository. This means that you need to provide 4 pieces of information to file a pull request: • source repository • source branch • destination repository • destination branch
  • 44. Look out A pull request requires either two distinct branches or two distinct repositories.
  • 45. A pull request using Bitbucket This is the most simple Workflow: • A developer creates the feature in a dedicated branch in their local repo. • The developer pushes the branch to a public Bitbucket repository. • The developer files a pull request via Bitbucket. • The rest of the team reviews the code, discusses it, and alters it. • The project maintainer merges the feature into the official repository and closes the pull request.
  • 46. Accept a pull request Only a user with write permissions on the destination repository can accept or reject a pull request. Any user with read permission in a repository can review the open, accepted and rejected pull requests.
  • 47. Decline a pull request Declining a pull request cannot be undone. Once you decline a pull request you will have to open a new pull request request to continue a review. Declining a pull request has no effect on the branches (source or destination) so the changes in the source branch are still in that source branch.