Archi's Academy

BLACK FRIDAY

85% Discount for all November

clock-icon
00days
00hours
00minutes
00seconds
Get in touch

Management solution

Open source

Version Control

Git and GitHub is a must for any developer. At some point of your path, especially if it is related to the software industry, you will definitely hear of “Git” and “GitHub”. Even if you haven’t heard about them, I will briefly touch on what those terms are. After that, I’ll go into further details of gitflow which is a branching strategy that helps management of your code.

Git is a version control system which tracks your code for any changes and records it. So it gives an opportunity to revert the changes you made mistakenly, or make a version update after fixing the issue. Beside that, it is possible to collaborate on the project with team members as they can also contribute to the source.

GitHub cannot be imagined without git, so it is the main component of the website. It hosts “more than 190 million repositories (including at least 28 million public repositories)”. Those repositories may consist of the source code of a software , or even book contents. They provide some features such as pull requests and task management.

Gitflow is a branching strategy designed by Vincent Driessen in 2010. It helps developers to organize their work by providing git commands that allows interacting with various types of branches such as develop, main, release, hotfix etc. This can be a great option for release-based software workflow. However, things can get really messy and overcomplicated if applied to large projects.

Gitflow must be initialized at the first stage. During initialization, it’ll ask about naming conventions about the branches and you can leave it empty to go with default settings.

GitHub 1.png

Base Branches & Supporting Branch

All version updates will be merged into either both base branches or one of them like the develop branch. Thus, those must be permanent during the process and created at the beginning of the project, as they are “base branches”. On the other hand, supporting branches won’t be seen in your branch list of the repository. Those will be deleted after the process comes to an end with merging the code, so we can say that those are temporary branches to support the base.

Base Branches

Main Branch: Contains production-ready code that is already available for the users. Mostly, it stores fixed and optimized official releases and each release has its own version tag. However, if an issue occurs at the product that is already in use, it has to be solved immediately. At this point, the hotfix branch will be the right choice to support the main/master branch.

Develop Branch: Contains all of the code, whether it is in production stage or pre-production stage. Rest of the supporting branches will be the “sub-branches” of this branch, to define them personally.

Supporting Branches

Hotfix Branch: As mentioned before, it is used for fixing the issues on the main branch. The changes must be merged into both base branches as we don’t want to see the same problem on our development stage.

Feature Branch: It'll be created for each feature that is going to be in the product. It will be directly merged into the development branch if there are no major bugs to solve.

Release Branch: We’ll want to use this branch to review the feature that is going to be released. It will be tested and fixed, so it will be cleared from the minor bugs. After putting the finishing touches, it will be merged into both base branches.

Bugfix Branch: Using this branch depends on the branching strategy. If it is preferred to be used, testing will be held here and bugs will be fixed.

How to Use Git Flow Commands

In the first image, it is shown how to initialize git flow in Git Bash. Now, It’s time to use the other features. We will follow this command order to do that:

$ git flow support_branch_type start give_a_name_for_that_branch
$ git flow feature start landing-page

When the work is done follow the same order but change the start command to finish:

$ git flow support_branch_type finish give_a_name_for_that_branch
$ git flow feature finish landing-page

Here is the example of a diagram for overall process:

GitHub 3.png

That was all about GitHub Workflow, drop a like and share it if you found it informative.

Goodbye have a nice day, meet you in next blog!

archis-trainee

Lütfü Orçun Selbasan

Tuesday, Oct 26, 2021