Sitemap
Logan Pile

Logan Pile

Git Workflow

4 min readMay 15, 2019

In my journey on becoming a software developer, I’ve stumbled into the magic works of Git. At first it was a little tricky to understand. But with some practice, the basic concepts were easier to master. Then all of a sudden a new challenge arose… group projects. This is where I first realized how messy things could get when multiple people try to merge their own code into one. When things went wrong, the productivity of the project declined as we spent hours trying to figure out why did the code disappear or who’s code was better when two people wrote code for the same functionality. So this is a topic I am interested in using to write about for my first technical blog.

What is Git Workflow?

Git is a version control system that helps a software team to manage changes to source code over time. A git workflow is the standard convention that all team members will follow when using Git. This will help the team be consistent and productive during the lifecycle of the project. Git is very popular in software development because of its tree like structure; where you can branch off the master source code and work on that branch without affecting the master source code. Because of this structure, there are many different types of Git workflow.

Get Logan Pile’s stories in your inbox

Join Medium for free to get updates from this writer.

Some Types of Git Workflow

Press enter or click to view image in full size
Centralized Workflow

The Centralized workflow is the simplest workflow of them all because all changes are committed directly to master. This workflow doesn’t utilize branches so it is easy to follow for small teams or projects. Since branches are not used, this will make resolving issues within the code harder because it would be hard to isolate when the issue started. This workflow doesn’t require any of the team members to know much about Git and its advantages.

Press enter or click to view image in full size
Feature Branch Workflow

The Feature Branch Workflow will utilize the Git branching system where any new development could be written on a new branch without affecting master source code. This is very effective in large teams because multiple developers can work on different features without disturbing master. When a developer is finished with their branch, they will do a pull request to merge their feature branch into master. This allows other developers to review the new code and make any necessary changes before approving the merge. This type of workflow is usually the basic workflow and other workflows will build off this.

Press enter or click to view image in full size
Gitflow Workflow

The Gitflow workflow builds upon the Feature Branch workflow with the main concept of having sub-master branches. These sub-master branches have a very specific purpose and the master branch is only used for deploying the final version code. When these sub-master branches have been tested and are ready for production, they will then be merged into the master and released with a new version name. New sub-master branches are created to develop new features with the intention of being merged into master at the next version release. This workflow is ideal for projects with a scheduled release cycle and projects with one version. You have all the benefits of the Feature Branch workflow plus the ability for many teams to work on different features at the same time. Some draw backs are a lot of merge conflicts and supporting multiple versions where developers have to maintain the code.

Press enter or click to view image in full size
Fork and Merge Workflow

The last common workflow is the Fork and Merge workflow. This one is different from the others because every developer gets their own server-side repository to work on instead of a centralized repository. A developer will fork the company’s main repository which creates their own personal copy of that repository. The developer will then clone it down to their computer and work on it. When the work is done, changes are then pushed to their personal copy repository. The developer will then issue a pull request into the company’s main repository. The maintainer of the company’s main repository will approve or deny changes in the code. The maintainer will then push master up to main centralized repository and the next day the process is repeated. This type of workflow is mostly used for open source projects because it keeps the primary repository clean and doesn’t allow everyone to alter the master source code. But this type of workflow is more complicated and also more work to maintain.

The Best Git Workflow

In the end, it really depends on the size of the project and what your team members prefer. The best Git workflow is where everyone on the team agrees to follow and stick with. If someone goes against the workflow, it will most likely cause many issues along the way. If no specific workflow can be agreed upon, stick with the basic Feature Branch workflow and reap the advantages that Git provides for its developers.

--

--