ПІДТРИМАЙ УКРАЇНУ ПІДТРИМАТИ АРМІЮ
Uk Uk
GIT Flow

Gitflow Workflow is a Git workflow that helps with continuous software development and implementing

GitflowWorkflow is a Git workflow that helps with continuous software development and implementing DevOps practices. It was first published and made popular by Vincent Driessen at nvie. The Gitflow Workflow defines a strict branching model designed around the project release. This provides a robust framework for managing larger projects. This is suited for projects that releases are based on a schedule.

Gitflow workflow is not for everybody. But for those who loves and using it below are some shortcuts that can help you understand what is this workflow.

Installing git-flow plugin for git client is plain and simple. For mac-os, easiest to install is brew install git-flow.

Basic Commands and Configuration

  • git flow init
  • git flow feature start/finish
  • git flow release start/finish
  • git flow hotfix start/finish
  • git merge

Basic Configuration Flow

Image description

Concurrent Configuration Flow

Image description

The overall flow of Gitflow is:

  1. develop branch is created from main.
  2. release branch is created from develop.
  3. Feature branches are created from develop.
  4. When a feature is complete it is merged into the develop branch.
  5. When the release branch is done it is merged into develop and main.
  6. If an issue in main is detected a hotfix branch is created from main.
  7. Once the hotfix is complete it is merged to both develop and main and/or feature branches.

Git vs Git Flow Commands

These are base guidelines that corresponds to some of the git commands used by the git-flow wrapper client. These commands are not fixed in stone. Depending on situations, there are steps that can be altered or change within the course of the development.

Create a develop branch on your local if one doesn’t exists in the repo.

  • Initialisation (specific for git flow only)
$ git flow init
Which branch should be used for bringing forth production releases?
 - develop
 - master
Which branch should be used for integration of the "next release"?
 - master
 - develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [../../.git/hooks]
  • Creating feature branches
git flow feature start 

vs

git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git checkout -b feature/ # this creates a branch named 'feature/'
git push --set-upstream origin feature/ # push changes to git repo to a new 'feature/'
  • Completed a feature
git flow feature finish 

vs

git checkout feature/ # this switches the branch to the 'feature/' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge feature/ # merge feature/branch to develop
git push # push changes to git repo in develop branch
  • Creating a release branch
git flow release start 

vs

git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git checkout -b release/ # this creates a branch named 'release/'
git push --set-upstream origin release/ # push changes to git repo to a new 'release/' and this will trigger the BUILD to QA
  • Release Completed
git flow release finish 

vs

git checkout release/ # this switches the branch to the 'release/' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge release/ # merge release/branch to develop
git push # push changes to git repo in develop branch
git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git merge release/ # merge release/branch to main
git push # push changes to git repo in main branch
git push --tags # push tags
git push -d origin release/ # delete remote branch
  • Creating a hotfix
git flow hotfix start 

vs

git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git checkout -b hotfix/ # this creates a branch named 'hotfix/'
git push --set-upstream origin hotfix/ # push changes to git repo to a new 'hotfix/' and this will trigger the BUILD to QA
  • Hotfix Completed
git flow hotfix finish 

vs

git checkout hotfix/ # this switches the branch to the 'hotfix/' if you are not in it, do a `git pull` to make sure it is latest
git checkout develop # this switches the branch to the develop branch, do a `git pull` to make sure it is latest
git merge hotfix/ # merge hotfix/branch to develop
git push # push changes to git repo in develop branch
git checkout main # this switches the branch to the main branch, do a `git pull` to make sure it is latest
git merge hotfix/ # merge hotfix/branch to main
git push # push changes to git repo in main branch
Ресурс : dev.to


Scroll to Top