Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git collaboration
  6. Branching workflows
  7. Example Git branching workflow
GuidesSoftware DevelopmentBacklog

Project and code management together.

Example Git branching workflow

You will need to create a branching strategy that works best for your team, of course. But here is a quick example of how to follow a branching strategy workflow involving two types of branches: a develop/integration branch and a feature/topic branch.

Say you are working on a new feature when somebody finds a bug in the production, and you must fix that bug parallel to working on the new feature.

On the way of work on a topic branch to add functions, it becomes necessary to fix bugs.

Before starting on the bug fix, you create a new branch off of the develop branch. This new branch isolates the bug fix from the new feature you were working on.

You can start working independently from the addition of functions by creating a new topic branch for fixing bugs.

When ready to release the bug fix, you merge the bug fix feature branch into the develop branch.

You can make it public by including it in the original branch

Then you switch back to your original feature branch and continue working on the new feature.

You can go back to the original branch to continue working on the addition of functions

On the feature branch, you notice that commit “X,” the bug fix commit, is needed to continue implementing the new feature. In other words, you have to synchronize your current branch with the changes on the develop branch.

There are two options to go about doing this: the first is to merge the develop branch that includes commit “X” with the current branch; the second option is to rebase the current branch to the develop branch that includes commit “X.”

For this example, you use the rebase approach.

Rebase a unified branch

Once you have “X” in your current working tree, you can begin safely working on the new feature again.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life