In this article will explain what Git Flow is, how workflow using Git Flow looks like, why you should use Git Flow methodology for development in a team environment, and also the reason you might find to not use Git Flow.
What is Git Flow
Git flow is nothing but a methodology to make developers adhere to a set of rules and principles, these set of rules encompasses the way developers should prefix their branch accordingly.
However, even when Git Flow is a methodology, the way of developing along with other developers, it can be achieved by following the same standard as that defined in Git Flow. Breaking down the above statement, let's say you have a branch called MyBranch, developers can agree to prefix any introduced features on MyBranch branch with a set of rules.
Nevertheless, the principles defined by Git Flow is nothing but a standard of level of branching. It says every working repository should have a Master and Develop branches respectively. Every branch should branch off Develop, and Master branch should only contain ready for production code.
These sets of rules make Git Flow viable for managing large projects and working cohesively with remote Developers. In the next paragraph, I will write about how the branching methodology works and what to know before embarking on using Git Flow for your project.
Git Flow Diagram
When using Git Flow, developers should branch from Develop Branch and Master Branch should only contain code that is ready for deployment. The project owner should be in charge of approving Pull Requests also predominantly known as PR in the Software Development community.
Git flow is a methodology, however, there are extensions and code wrappers created that helps developers remember git or custom commands. For example, a developer would want to create a branch and checkout to that branch at once, guess what, there is a command for that in Git Flow.
If a developer is using a GUI version of git client, chances are that Git Flow extension is already installed and you just have to know how to activate Git Flow. By activating Git Flow, there is no restriction from using a normal standard of branching. Git Flow does not restrict Developers from going back to how they used to develop, meaning, you can easily switch back and forth which I do not recommend due to consistency. When you work in a collaborative environment developing a huge code base, consistency is the key. By following the rules you are able to help other developers navigate through a complex Source Tree or history of commits.
Why should you even use Git Flow any way
Team or a company should define a set of rules and principles around committing or developing a Code Base. These sets of rules define how software should be developed and any new developers joining the team should adapt to the principles.
This makes managing the code so easily as developers are free to mess around with code on their own local branches when they see that their code is well implemented and ready to be merged into a Develop branch then they push their branch to Remote Repository.
After pushing the branch to Remote Repository, the project manager or Team Leader would have to review the code and sit down with a developer one on one to find out if the code meets the standard. If the code passes review then it is merged in Develop Branch ready for other developers to Pull the changes to their local Develop branch.
It is ideally not a viable mean of managing very complex and huge projects, meaning if you deploy releases to a software every single time. Deploying code changes from the Master Branch should be scheduled task and planned after testing the code base. However, if you use Git Flow for deployment on a project that ships code more often, the Git Flow might just create a bunch of convoluted commit history which would be very hard to manage.