Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Gitflow workflow explained

Tuesday, September 6th, 2016 by Servage

gitflowGit or an equivalent version control system (VCS) is an essential tool in web development. No matter what VCS you use, it is good to know the basics of Git since it is by far the most popular choice these days. Git is a versatile tool and there are multiple ways, also called workflows, to use it. One popular workflow is the Gitflow workflow, which we will cover in this article.

Branches in Gitflow

Many Git workflows use one branch to track the history of a project. Most often this is the master branch. In Gitflow there are two branches for this purpose: master and develop. The develop branch contains the latest features that have been added to the project. These features may be experimental but are usually stable enough to be soon released in the next product version, and this is what the master branch is for.

The master branch contains stable code that is ready to be released. When code from the develop branch is moved to master, a new release version is created, for example from v1.1 to v1.2. At the same time, it is a good idea to tag the new commit in master with a tag such as ”v1.2”. All commits that make up a new version should be tagged in the master branch. This makes it easy to quickly find previous versions of the product.

Feature branches

All new features in Gitflow are created in their own branches. For example if you are working on a network monitor dashboard and you want to add a new notifications widget to the dashboard, you would do so by creating a new branch from the develop branch. It is important to note that feature branches are created from the develop branch, never from master directly. Similarly, when the feature is ready, it is merged back to develop.

Release branches

When enough feature branches are merged to the develop branch, or when a release date for the next version is due soon, it is time to create a new version of the product. At this time, you create a new branch from develop. After this, no new features are accepted to the next version anymore, except bug fixes and whatever else might be part of the features in that version, such as documentation and installation or upgrading instructions.

Releasing a new version

When the release branch contains everything it needs, you are ready to release the new version. This is done by merging the release branch to master and tagging it with a version number as mentioned earlier.

Advantages in Gitflow workflow

This was only a brief introduction to Gitflow, and there is certainly more to the workflow, such as maintenance branches. The advantage in using so many branches is that when you are preparing for the next release, other developers can continue to work on features for the next version in their own branches without conflicting with the version that is currently being prepared for release. This makes Gitflow popular especially in enterprises and big teams.

Gitflow workflow explained, 3.4 out of 5 based on 5 ratings
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.