What is branch workflow?
Using version control on Git, your team can create processes. Branch workflow is all about how your organization uses a process while working on a project in a code repository. It's a great way to streamline your software development project!
What is a branch workflow, exactly?
Good question! Let's start by taking a look at how we have been using branches so far. Start with your master branch. When you work on your local repository, you create another branch that originates from the master branch.
However, teams don't just work on one branch. There are several branches with pull requests sent back to the remote repository to be merged into the master branch. Typically, branches that are merged into the master branch add a feature, solve an issue or create an alternate version, that can be used later. Before merging, teams test each branch to make sure they work with the current source code, and ensure they won't introduce bugs! 🐛
This process is a software development project workflow. So how does an organization determine what kind of a workflow suits its business needs? Well, that's up to the organization - all projects work differently!
Why do companies have different workflows?
All software development companies have a process that determines the workflow of how a project begins all the way to the end. This is called the software development life cycle (SDLC).
There are many forms of this life cycle, and the one that is used depends on the company culture. That said, a workflow using Git can often coincide with the SDLC. One way of doing that is to have branches that correspond with some of the SDLC phases. This typically happens after some source code has been implemented and after the analysis or design of earlier phases. However, it is possible to have documents from all phases saved in a code repository regardless of whether it is source code!
Some company workflows will have one master branch, and assign people to test branches from other team members.Other companies, like Stack Overflow, will give all team members access to the master branch and they won't even use a branching system! Creating a workflow can get pretty complicated when you have a lot of moving pieces, which is why teams rely on pre-existing workflows - like GitFlow!
Learn a popular workflow: GitFlow!
GitFlow has specific branches for specific roles and processes. There are feature, develop, release, and the master branch. You can also have a branch called hotfixes for quick fixes! Each team will handle a different part of the Git workflow, and will have its own designated branches to work on to streamline the process.
GitFlow is designed to have a development team that works on features in branches separate from the master branch. These features can have specific functionality that needs to be added to the code, or in a web app project, or a specific page, etc. The team members will code on their designated features branches. When they finish, they commit to the develop branch.
The QA team (quality assurance) has access to the develop branch and starts testing that commit. Once testing is complete, the release branch will hold the tested commit, and then merge it into the develop branch. When all the features for an upcoming version have been merged to the develop branch, a merge to the master branch will create the latest version.
GitFlow gained popularity because it helped modularize workflows and provided specific roles and permission to specified branches in the repository. Can you imagine having a large team working on the same project with no real streamlined workflow? It would be complete chaos! 💥
Every organization has a workflow for software development.
Figuring out a workflow with branching is essential when using Git for software development.
A popular workflow, GitFlow, has specific workflows with branches called feature, development, release, and master.