Skip to content
Daniel edited this page Oct 24, 2013 · 11 revisions

GIT WORKFLOW

INFITE LIFETIME BRANCHES:

MASTER BRANCH:

Naming convention: master
Observations:

  • Always reflects a production-ready state. 
    
  • By definition, every commit on master is a new release. 
    
  • Only release branch and hotfix branch can commit into master.
    
  • Tag name convention: x.x.x (where x must be a positive number. For example, 1.23.456)
    

Branch off (start): N/A.
Merge back: N/A.

DEVELOP BRANCH:

Naming convention: develop
Observations: It always reflects a state with the latest delivered development changes for the next release.
Branch off: master (starting the project)
Merge back: N/A.

LIMITED LIFETIME BRANCHES:

FEATURE BRANCH:

Naming convention: feature-* (where * must reference to issue number on GitHub. For example, feature-1 references to issue#1.)
Branch off: develop.
Merge back: develop.

Create:

$ git checkout -b feature-* develop
Switched to a new branch "myfeature"

Finish:

$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff feature-*
Updating ea1b82a..05e9557
(Summary of changes)
			
$ git branch -d feature-*
Deleted branch feature-* (was 05e9557).
$ git push origin develop

Optional: 
$ git push origin :feature-*
- [deleted]         feature-*
			
Where * must be a version number.

RELEASE BRANCH:

Naming convention: release-* (where * could be x.[x+1].0 or [x+1].0.0)
Observations:

  • The key moment to branch off a new release branch from develop is when develop (almost) reflects the desired state of the new release.
  • Only commit bugfixes.

Branch off: develop.
Merge back: develop and master

Create:

$ git checkout -b release-* develop
Switched to a new branch "release-*"
$ ./bump-version.sh *
Files modified successfully, version bumped to *.
$ git commit -a -m "Bumped version number to *"
[release-* 74d9424] Bumped version number to *
1 files changed, 1 insertions(+), 1 deletions(-)
			
Where * must be a version number.

Finish:

$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release-*
Merge made by recursive.
(Summary of changes)
$ git tag -a *
			
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff release-*
Merge made by recursive.
(Summary of changes)
			
$ git branch -d release-*
Deleted branch release-* (was ff452fe).

Optional: 
$ git push origin :release-*
- [deleted]         release-*

Where * must be a version number.

HOTFIX BRANCH:

Naming convention: hotfix-* (where * must be x.x.[x+1])
Observations:

  • It may be branched off from the corresponding tag on the master branch that marks the production version.

Branch off: master.
Merge back: develop and master.

Create:

$ git checkout -b hotfix-* master
Switched to a new branch "hotfix-*"
$ ./bump-version.sh *
Files modified successfully, version bumped to *
$ git commit -a -m "Bumped version number to *"
[hotfix-* 41e61bb] Bumped version number to *
1 files changed, 1 insertions(+), 1 deletions(-)
			
Where * must be a version number.

Finish:

$ git checkout master
Switched to branch 'master'
$ git merge --no-ff hotfix-*
Merge made by recursive.
(Summary of changes)
$ git tag -a *
			
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff hotfix-*
Merge made by recursive.
(Summary of changes)
			
$ git branch -d hotfix-*
Deleted branch hotfix-* (was abbe5d6).

Optional
$ git push origin :hotfix-*
- [deleted]         hotfix-*
			
Where * must be a version number.