Gitflow Workflow 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.

Gitflow is ideally suited for projects that have a scheduled release cycle and for the DevOps best practice of continuous delivery. This workflow doesn’t add any new concepts or commands beyond what’s required for the Feature Branch Workflow. Instead, it assigns very specific roles khổng lồ different branches and defines how and when they should interact. In addition to feature branches, it uses individual branches for preparing, maintaining, và recording releases. Of course, you also get to lớn leverage all the benefits of the Feature Branch Workflow: pull requests, isolated experiments, and more efficient collaboration.

Bạn đang xem: Github

Getting Started

Gitflow is really just an abstract idea of a Git workflow. This means it dictates what kind of branches khổng lồ phối up & how lớn merge them together. We will touch on the purposes of the branches below. The git-flow toolmix is an actual comm& line tool that has an installation process. The installation process for git-flow is straightforward. Packages for git-flow are available on multiple operating systems. On OSX systems, you can exexinh đẹp brew install git-flow. On windows you will need to download và install git-flow. After installing git-flow you can use it in your project by executing git flow init. Git-flow is a wrapper around Git. The git flow init command is an extension of the default git init comm& và doesn"t change anything in your repository other than creating branches for you.

How it works


Develop và Main Branches

Instead of a single main branch, this workflow uses two branches lớn record the history of the project. The main branch stores the official release history, & the develop branch serves as an integration branch for features. It"s also convenient khổng lồ tag all commits in the main branch with a version number.

The first step is khổng lồ complement the default main with a develop branch. A simple way khổng lồ vì chưng this is for one developer lớn create an empty develop branch locally và push it to the server:

This branch will contain the complete history of the project, whereas main will contain an abridged version. Other developers should now clone the central repository và create a tracking branch for develop.

When using the git-flow extension library, executing git flow init on an existing repo will create the develop branch:


Branchnamefor"nextrelease"development:Howtonameyoursupportingbranchprefixes?Featurebranches?Releasebranches?Hotfixbranches?Supportbranches?Versiontagprefix?<>$gitbranch*develop main

Feature Branches

Each new feature should reside in its own branch, which can be pushed khổng lồ the central repository for backup/collaboration. But, instead of branching off of main, feature branches use develop as their parent branch. When a feature is complete, it gets merged baông chồng into lớn develop. Features should never interact directly with main.


chú ý that feature branches combined with the develop branch is, for all intents & purposes, the Feature Branch Workflow. But, the Gitflow Workflow doesn’t stop there.

Feature branches are generally created off to lớn the lakiểm tra develop branch.

Creating a feature branch

Without the git-flow extensions:

When using the git-flow extension:

git flow feature start feature_branchContinue your work và use Git like you normally would.

Finishing a feature branch

When you’re done with the development work on the feature, the next step is to lớn merge the feature_branch into lớn develop.

Xem thêm: Dãy Hoạt Dộng Hóa Học Của Kim Loại Là Gì? Ý Nghĩa Dãy Hoạt Động Hóa Học

Without the git-flow extensions:

Using the git-flow extensions:

git flow feature finish feature_branch

Release Branches

Once develop has acquired enough features for a release (or a predetermined release date is approaching), you fork a release branch off of develop. Creating this branch starts the next release cycle, so no new features can be added after this point—only bug fixes, documentation generation, & other release-oriented tasks should go in this branch. Once it"s ready to ship, the release branch gets merged inkhổng lồ main & tagged with a version number. In addition, it should be merged bachồng inkhổng lồ develop, which may have sầu progressed since the release was initiated.

Using a dedicated branch to lớn prepare releases makes it possible for one team to polish the current release while another team continues working on features for the next release. It also creates well-defined phases of development (e.g., it"s easy lớn say, “This week we"re preparing for version 4.0,” and lớn actually see it in the structure of the repository).

Making release branches is another straightforward branching operation. Like feature branches, release branches are based on the develop branch. A new release branch can be created using the following methods.

Without the git-flow extensions:

Once the release is ready lớn ship, it will get merged it inkhổng lồ main & develop, then the release branch will be deleted. It’s important lớn merge back into lớn develop because critical updates may have been added lớn the release branch and they need lớn be accessible to new features. If your organization stresses code review, this would be an igiảm giá place for a pull request.

To finish a release branch, use the following methods:

Without the git-flow extensions:

Hotfix Branches

Maintenance or “hotfix” branches are used to quickly patch production releases. Hotfix branches are a lot lượt thích release branches và feature branches except they"re based on main instead of develop. This is the only branch that should fork directly off of main. As soon as the fix is complete, it should be merged inlớn both main và develop (or the current release branch), và main should be tagged with an updated version number.

Having a dedicated line of development for bug fixes lets your team address issues without interrupting the rest of the workflow or waiting for the next release cycle. You can think of maintenance branches as ad hoc release branches that work directly with main. A hotfix branch can be created using the following methods:

Without the git-flow extensions:


A complete example demonstrating a Feature Branch Flow is as follows. Assuming we have a repo setup with a main branch.




Here we discussed the Gitflow Workflow. Gitflow is one of many styles of Git workflows you & your team can utilize.

Some key takeaways to lớn know about Gitflow are:

The workflow is great for a release-based software workflow. Gitflow offers a dedicated channel for hotfixes lớn production.

The overall flow of Gitflow is:

A develop branch is created from main A release branch is created from develop Feature branches are created from develop When a feature is complete it is merged into lớn the develop branch When the release branch is done it is merged into lớn develop and main If an issue in main is detected a hotfix branch is created from main Once the hotfix is complete it is merged to both develop & main

Next, learn about the Forking Workflow or visit our workflow comparison page.