
GitFlow is a collection of Git commands to provide many repository operations with just single command. It helps to keep track of features, hotfixes and releases in projects. It is used for projects where you might have multiple streams of work running concurrently.
Installing git-flow
+ OSX
- Homebrew: $ brew install git-flow-avh
- Macports: $ port install git-flow-avh
+ Linux
$ apt-get install git-flow
+ Windows (Cygwin)
$ wget -q -O - --no-check-certificate
install stable | bash
See the Wiki for detailed Installation Instructions.
Initialization
You need to initialize a new repo inside an existing git repository. Run following command:
git flow init [-d]
<p><strong>-d</strong> flag will accept all defaults.</p>
<p>This will ask questions like which branches you would like to use as development and production branches, and how would your prefixes be named. Press Enter to accept default suggestions.<br />
</p>
<h4><strong>FEATURE BRANCHES</strong></h4>
<p>Using git-flow feature branches you can easily work on multiple features of project at the same time.</p>
<p><strong>+ Create a feature branch</strong></p>
<p>New feature branch is created from the 'develop' branch and switches to it.</p>
git flow feature start MYFEATURE

+ List all feature branches
- git flow feature
+ Publish a feature branch
Push a feature branch to the remote repository.
- git flow feature publish MYFEATURE
Note: This can be used only once in a branch, next time you want to push any code in same feature branch you need to use:
- git push origin feature/MYFEATURE
+ Track a feature branch
Get a feature published by another user (Pull a feature branch). git flow feature track MYFEATURE
This is similar to:
- git checkout feature/MYFEATURE
- Git pull origin feature/MYFEATURE
+ Finish a feature branch
Finish the development of a feature. This action performs the following:
- Merges MYFEATURE into 'develop'
- Removes the feature branch
- Switches back to 'develop' branch
- git flow feature finish MYFEATURE

VERSIONED RELEASE
Using git-flow release branches you can create tagged and versioned releases. Create a new release branch when you have completed current version and it’s ready to deploy to production.
+ Create a release branch
New release branch is created from the 'develop' branch and switches to it. git flow release start MYRELEASE

+ List all release branches
- git flow release
<p><strong>+ Publish a release branch</strong></p>
<p>Push a release branch to the remote repository.</p>
- git flow release publish MYRELEASE
<p><strong>+ Track a release branch</strong></p>
<p>Get a release published by another user (Pull a release branch).</p>
- git flow release track MYRELEASE
+ Track a release branch
Get a release published by another user (Pull a release branch).
- git flow release track MYRELEASE
+ Finish a release branch
Finish the development of a release. This action performs the following:
- Merges MYRELEASE into ’master’
- Tags the release with its name
- Back-merges the release into 'develop'
- Removes the release branch
git flow release finish MYRELEASE
Note: Don't forget to push your tags
git push --tags

HOTFIXING PRODUCTION CODE
Using hotfix branches you can act immediately upon an undesired bugs on production version.
+ Create a hotfix branch
New release branch is created from the 'develop' branch and switches to it.
git flow hotfix start MYHOTFIX
myhotfix argument marks the new hotfix release name.

+ List all hotfix branches
- git flow hotfix
+ Finish a hotfix branch
Finish the development of a release. This action performs the following:
- Merges MYHOTFIX into ’master’ & ‘develop’
- Tags master merge with the hotfix version.
- git flow hotfix finish MYHOTFIX

Advantages of Git Flow
- Gitflow was developed to manage the branching mechanism with a standardised approach when developing features, handling releases and managing hotfixes.
- Using multiple separate branches in Git will provide flexibility but gets complex. This is easy in gitflow.
- Gitflow makes developer speed up the process with familiar branch structure.
- Single command to do multiple things at a time.
- Switching branches is easy.
- Keep repository & process clean and tidy.
Feel free to share your views regarding Git Flow we follow strictly for every project to ensure best results and need any assistance for Web Development Service Contact us now!!