Git – How to use git-flow?

Ref: git-flow

Point of view

The overall flow of Gitflow is:

  • develop branch is created from master
  • release branch is created from develop
  • Feature branches are created from develop
  • When a feature is complete it is merged into the develop branch
  • When the release branch is done it is merged into develop and master
  • If an issue in master is detected a hotfix branch is created from master
  • Once the hotfix is complete it is merged to both develop and master

Install

brew install git-flow

cd into project folder

git flow init
// Not using gir-flow
git branch develop
git push -u origin develop

When starting to work on new feature

git flow feature start <your-branch-name>
// Not using git-flow
git checkout develop
git checkout -b feature_branch

When finishing working on new feature

git flow feature finish <your-branch-name>
// Not using git-flow
git checkout develop
git merge feature_branch

You will see the following messages

  • The feature branch ‘feature/<your-branch-name>’ was merged into ‘develop’
  • Feature branch ‘feature/<your-branch-name>’ has been removed
  • You are now on branch ‘develop’

Release a branch

Create release branch

git flow release start 1.0.0
// Not using git-flow
git checkout develop
git checkout -b release/1.0.0

Merge release branch to master

git flow release finish '1.0.0'
// Not using git-flow
git checkout master
git merge release/1.0.0

Hot fix

Create hot fix branch

git flow hotfix start hotfix_branch
// Not using git-flow
git checkout master
git checkout -b hotfix_branch

Release hot fix branch

git flow hotfix finish hotfix_branch
// Not using git-flow
git checkout master
git merge hotfix_branch
git checkout develop
git merge hotfix_branch
git branch -D hotfix_branch

Be the first to comment

Leave a Reply

Your email address will not be published.


*