Difference between revisions of "Git Flow"

From GLMWiki
Jump to: navigation, search
Line 27: Line 27:
  
 
git release
 
git release
  git release start v1.0 (then do your work and commit)
+
  git flow release start v1.0 (then do your work and commit)
  git release finish v1.0
+
  git flow release finish v1.0
  
 
git hotfix
 
git hotfix
  git hotfix start v1.0.1 (then do your work and commit)
+
  git flow hotfix start v1.0.1 (then do your work and commit)
  git hotfix finish v1.0.1
+
  git flow hotfix finish v1.0.1
  
 
When you're done with either a hotfix or release you need to push all branches and tags
 
When you're done with either a hotfix or release you need to push all branches and tags

Revision as of 13:06, 28 August 2014

Git Flow Workflow

git-flow

Branches:

master => used for production code only

develop => used for developing new features (never ending)

hotfix => used for maintenance (get merged into master and develop once done)

release => used for creating new releases of code from the develop branch (merges back into master and develop)


to start an project clone the git repo and initialize the git flow

$ git clone git@cvs2:web/SooLocks.git www.soolocks.com
$ cd www.soolocks.com
$ git flow init -d

NOTICE: If others have been working on the project and have made a release or hotfixes before you you'll need to update all your branches. (usually your on only develop and only that is the one you are updating)

$ git pull --all

It helps to setup for local branches as tracking branches

$ git branch --set-upstream master origin/master
$ git branch --set-upstream develop origin/develop

git release

git flow release start v1.0 (then do your work and commit)
git flow release finish v1.0

git hotfix

git flow hotfix start v1.0.1 (then do your work and commit)
git flow hotfix finish v1.0.1

When you're done with either a hotfix or release you need to push all branches and tags

git push --all
git push --tags

NOTICE: it is wise to do a git pull first before you start with a release or hotfix

Tutorials

Git Flow

Cheat Sheets

http://danielkummer.github.io/git-flow-cheatsheet/

When to use develop

For new features or revamps.

When to use hotfix

Use a hotfix for doing any small site updates like graphic changes or text changes. These changes are typically not considered

usage:

$ git flow hotfix start "v1.1.6"

Do your work (text edits or other stuff.

$ git flow hotfix finish "v1.1.6"


When to use support

These branches are just started and not intended to be merged back to master nor develop. This is usually fine, as fixes to "ancient" releases or features requested by customers to be implemented in "ancient" releases can't or should not go back into master. If you still think, you want to port a fix to your main development line (represented by master and develop), just start a hotfix, cherry-pick your changes and finish the hotfix.