Git Flow

Post on 06-May-2015

612 views 1 download

Tags:

transcript

GIT Flowfacebook.com/mfernandes.fernando

Friday, August 10, 12

Why GIT?

Friday, August 10, 12

Why GIT?• Distributed

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

• Easy: git checkout -b <someFeature>

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

• Easy: git checkout -b <someFeature>

• Convenient: Create, try out an idea, commit, switch back, merge or discard.

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

• Easy: git checkout -b <someFeature>

• Convenient: Create, try out an idea, commit, switch back, merge or discard.

• Small and Fast

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

• Easy: git checkout -b <someFeature>

• Convenient: Create, try out an idea, commit, switch back, merge or discard.

• Small and Fast

• Written in C (which reduces runtime overhead associated with high-level languages)

Friday, August 10, 12

Why GIT?• Distributed

• A clone of the *entire* repository (history, tags) in each dev machine

• Code on the road! You are the repository. Multiple backups.

• Branching model

• Easy: git checkout -b <someFeature>

• Convenient: Create, try out an idea, commit, switch back, merge or discard.

• Small and Fast

• Written in C (which reduces runtime overhead associated with high-level languages)

• Built to work on the Linux kernel (it has had to effectively handle large repositories from day one)

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Benchmarks

Friday, August 10, 12

Staging (or index) Area

Friday, August 10, 12

Staging (or index) Area

Friday, August 10, 12

Staging (or index) Area

Friday, August 10, 12

Free and Open Source

Friday, August 10, 12

Free and Open Source

• GPLv2

Friday, August 10, 12

Free and Open Source

• GPLv2

• Free, forever

Friday, August 10, 12

Free and Open Source

• GPLv2

• Free, forever

• Download, inspect and modify GIT source

Friday, August 10, 12

Workflows

Friday, August 10, 12

Workflows

• getBestWorkflow()

Friday, August 10, 12

Workflows

• getBestWorkflow()

• NPE

Friday, August 10, 12

Workflows

• getBestWorkflow()

• NPE

• ANY!

Friday, August 10, 12

Subversion-Style

Friday, August 10, 12

Subversion-Style

Friday, August 10, 12

Integration Manager

Friday, August 10, 12

Integration Manager

Friday, August 10, 12

Dictator and Lieutenants

Friday, August 10, 12

Dictator and Lieutenants

Friday, August 10, 12

gitflow

Friday, August 10, 12

gitflow• GIT abstraction

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

• develop

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

• develop

• Support branches:

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

• develop

• Support branches:

• feature

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

• develop

• Support branches:

• feature

• release

Friday, August 10, 12

gitflow• GIT abstraction

• Just a bunch of scripts

• Greatly inspired by existing models

• Main branches:

• master

• develop

• Support branches:

• feature

• release

• hotfix

Friday, August 10, 12

gitflowThe BIG picture

Friday, August 10, 12

gitflowThe BIG picture

Friday, August 10, 12

gitflow: Main branches

Friday, August 10, 12

gitflow: Main branches

Friday, August 10, 12

gitflow: Main branches• origin/master is

where the source code of HEAD always reflects a production-ready state.

Friday, August 10, 12

gitflow: Main branches• origin/master is

where the source code of HEAD always reflects a production-ready state.

• origin/develop is where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

• Branch off from: DEVELOP

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

• Branch off from: DEVELOP

• Must merge back into: DEVELOP

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

• Branch off from: DEVELOP

• Must merge back into: DEVELOP

• Branch naming convention:

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

• Branch off from: DEVELOP

• Must merge back into: DEVELOP

• Branch naming convention:

• <devName>-* (fernando-gallery)

Friday, August 10, 12

gitflow: Supporting branches - FEATURE

• Definition: used to develop new features for the upcoming or a distant future release.

• Tipically exist in developer repos only, NOT IN ORIGIN

• Branch off from: DEVELOP

• Must merge back into: DEVELOP

• Branch naming convention:

• <devName>-* (fernando-gallery)

• (!) Not allowed: master, develop, release-* or hotfix-*

Friday, August 10, 12

gitflow: Supporting branches - RELEASE

Friday, August 10, 12

gitflow: Supporting branches - RELEASE

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

• When? develop (almost) reflect the desired state of the new release. All planned features were implemented.

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

• When? develop (almost) reflect the desired state of the new release. All planned features were implemented.

• Branch off from: DEVELOP

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

• When? develop (almost) reflect the desired state of the new release. All planned features were implemented.

• Branch off from: DEVELOP

• Must merge back into: DEVELOP and MASTER

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

• When? develop (almost) reflect the desired state of the new release. All planned features were implemented.

• Branch off from: DEVELOP

• Must merge back into: DEVELOP and MASTER

• Branch naming convention:

Friday, August 10, 12

gitflow: Supporting branches - RELEASE• Definition: support preparation of a new

production release. Allow for MINOR bug fixes and preparing meta-data for a release (version number, build dates, etc.)

• When? develop (almost) reflect the desired state of the new release. All planned features were implemented.

• Branch off from: DEVELOP

• Must merge back into: DEVELOP and MASTER

• Branch naming convention:

• <release>-* (release-1.0)Friday, August 10, 12

gitflow: Supporting branches - HOTFIX

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

• Branched off from the corresponding tag on the master branch that marks the production version.

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

• Branched off from the corresponding tag on the master branch that marks the production version.

• Branch off from: MASTER

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

• Branched off from the corresponding tag on the master branch that marks the production version.

• Branch off from: MASTER

• Must merge back into: DEVELOP and MASTER

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

• Branched off from the corresponding tag on the master branch that marks the production version.

• Branch off from: MASTER

• Must merge back into: DEVELOP and MASTER

• Branch naming convention:

Friday, August 10, 12

gitflow: Supporting branches - HOTFIX• Definition: arise from the necessity to

act immediately upon an undesired state of a live production version. CRITICAL bugs!

• Branched off from the corresponding tag on the master branch that marks the production version.

• Branch off from: MASTER

• Must merge back into: DEVELOP and MASTER

• Branch naming convention:

• hotfix-* (hotfix-1.2.1)Friday, August 10, 12

gitflowThe BIG picture

(again)

Friday, August 10, 12

gitflowThe BIG picture

(again)

Friday, August 10, 12

Feature. How?

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff myfeature

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff myfeature

• Updating ea1b92a...

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff myfeature

• Updating ea1b92a...

• git branch -d myfeature

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff myfeature

• Updating ea1b92a...

• git branch -d myfeature

• Deleted branch myfeature

Friday, August 10, 12

Feature. How?• git checkout -b myfeature develop

• Switched to a new branch “myfeature”

• Do some work. When done...

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff myfeature

• Updating ea1b92a...

• git branch -d myfeature

• Deleted branch myfeature

• git push origin develop

Friday, August 10, 12

--no-ff

Friday, August 10, 12

--no-ff• This flags causes the merge to

always create a new commit object.

Friday, August 10, 12

--no-ff• This flags causes the merge to

always create a new commit object.

• Without it, it’s impossible to see from Git history which of the commit objects together have implemented a feature.

Friday, August 10, 12

--no-ff• This flags causes the merge to

always create a new commit object.

• Without it, it’s impossible to see from Git history which of the commit objects together have implemented a feature.

• You will have to read all the log messages manually.

Friday, August 10, 12

--no-ff• This flags causes the merge to

always create a new commit object.

• Without it, it’s impossible to see from Git history which of the commit objects together have implemented a feature.

• You will have to read all the log messages manually.

• Compare:

Friday, August 10, 12

--no-ff• This flags causes the merge to

always create a new commit object.

• Without it, it’s impossible to see from Git history which of the commit objects together have implemented a feature.

• You will have to read all the log messages manually.

• Compare:

Friday, August 10, 12

Create a release. How?

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

• Switched to a new branch “release-1.2”

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

• Switched to a new branch “release-1.2”

• Manually modify the README, RELEASE NOTES, etc.

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

• Switched to a new branch “release-1.2”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2”

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

• Switched to a new branch “release-1.2”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2”

• [release-1.2 74d9424] Bumped to version 1.2

Friday, August 10, 12

Create a release. How?

• git checkout -b release-1.2 develop

• Switched to a new branch “release-1.2”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2”

• [release-1.2 74d9424] Bumped to version 1.2

• 1 files changed, 1 insertions(+), 1 deletions(-)

Friday, August 10, 12

Finish a release. How?

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• It may lead to a merge conflict. Fix it and commit.

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• It may lead to a merge conflict. Fix it and commit.

• Now we are really done and the release branch may be removed, since we don’t need it anymore.

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• It may lead to a merge conflict. Fix it and commit.

• Now we are really done and the release branch may be removed, since we don’t need it anymore.

• git branch -d release-1.2

Friday, August 10, 12

Finish a release. How?• When the release branch is ready to become a real release, it is merged into master (every commit on

master is a new release by definition) and the commit is tagged for easy future reference to this historical version. Finally it’s merged back into develop, so future releases contain the bug fixes.

• git checkout master

• Switched to branch “master”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• To keep the changes made in the release branch, we need to merge those back into develop.

• git tag -a 1.2 // Can use -s or -u <key> to sign cryptographically

• git checkout develop

• Switched to branch “develop”

• git merge --no-ff release-1.2

• Merge made by recursive. (Summary of changes)

• It may lead to a merge conflict. Fix it and commit.

• Now we are really done and the release branch may be removed, since we don’t need it anymore.

• git branch -d release-1.2

• Deleted branch release-1.2 (was ff452fe)

Friday, August 10, 12

Create a hotfix. How?

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

• 1 files changed, 1 insertions(+), 1 deletions(-)

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

• 1 files changed, 1 insertions(+), 1 deletions(-)

• Fix the bug and commit the fix.

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

• 1 files changed, 1 insertions(+), 1 deletions(-)

• Fix the bug and commit the fix.

• git commit -m “Fixed severe production problem”

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

• 1 files changed, 1 insertions(+), 1 deletions(-)

• Fix the bug and commit the fix.

• git commit -m “Fixed severe production problem”

• [hotfix-1.2.1 416e61] Fixed severe production problem.

Friday, August 10, 12

Create a hotfix. How?• git checkout -b hotfix-1.2.1 master

• Switched to a new branch “hotfix-1.2.1”

• Manually modify the README, RELEASE NOTES, etc.

• git commit -a -m “Bumped to version 1.2.1”

• [hotfix-1.2.1 416e61] Bumped to version 1.2.1

• 1 files changed, 1 insertions(+), 1 deletions(-)

• Fix the bug and commit the fix.

• git commit -m “Fixed severe production problem”

• [hotfix-1.2.1 416e61] Fixed severe production problem.

• 5 files changed, 32 insertions(+), 17 deletions(-)

Friday, August 10, 12

Finish a hotfix. How?

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff hotfix-1.2.1

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• Finally remove the temporary branch

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• Finally remove the temporary branch

• git branch -d hotfix-1.2.1

Friday, August 10, 12

Finish a hotfix. How?• git checkout master

• Switched to branch “master”

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• git tag -a 1.2.1 // Again, this can be done cryptographically

• Include the bugfix in develop too. The exception: if there is a release branch, the hotfix changes need to be merge into that release branch instead of develop.

• git checkout develop

• Switched to branch ‘develop’

• git merge --no-ff hotfix-1.2.1

• Merge made by recursive. (Summary of changes)

• Finally remove the temporary branch

• git branch -d hotfix-1.2.1

• Deleted branch hotfix-1.2.1 (was abbe5d6)

Friday, August 10, 12

It was just a flesh wound, right?

That’s it!

Friday, August 10, 12

Referenceshttp://nvie.com/posts/a-successful-git-branching-model/

http://learn.github.com/p/tagging.html

http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html

http://stackoverflow.com/questions/1616957/how-do-you-roll-back-reset-a-git-repository-to-a-particular-commit

http://stackoverflow.com/questions/1457103/what-is-the-difference-between-a-tag-and-a-branch-in-git

Friday, August 10, 12

Thanks!

Friday, August 10, 12