What is a Branching Strategy? What are Git Branching Strategies?



What is Branching Strategies?

Branches are primarily used as a means for teams to develop features giving them a separate workspace for their code. These branches are usually merged back to a master branch upon completion of work. In this way, features (and any bug and bug fixes) are kept apart from each other allowing you to fix mistakes more easily.


This means that branches protect the mainline of code and any changes made to any given branch don’t affect other developers.


Such a strategy is necessary as it helps keep repositories organized to avoid errors in the application and the dreaded merge hell when multiple developers are working simultaneously and are all adding their changes at the same time.


Need of Branching Strategy:

Having a branching strategy is necessary to avoid conflicts when merging and to allow for the easier integration of changes into the master trunk.

  • Enhance productivity by ensuring proper coordination among developers

  • Enable parallel development

  • Help organize a series of planned, structured releases

  • Map a clear path when making changes to software through to production

  • Maintain a bug-free code where developers can quickly fix issues and get these changes back to production without disrupting the development workflow


Git branching

Git branches allow developers to diverge from the main branch by creating separate branches to isolate code changes. The default branch in Git is the master branch.


In Git, a branch is essentially a reference or a pointer to the latest commit in a given context; it’s not a container for commits. As you create new commits in the new branch, Git creates new pointers to track the changes. Git branches, then, can be seen as a pointer to a snapshot of your changes.



Git Branching Strategy:

  1. GitFlow