Workflow for Git feature branching

The Git Feature Branch workflow is an efficient way to get working with your colleagues in Bitbucket. In this workflow, all feature development takes place on branches separate from the main master branch. As a result, multiple developers can work on their own features without touching the main code.

diagram of a branch

Start with the master branch

This workflow helps you collaborate on your code with at least one other person. As long as your Bitbucket and local repos are up-to-date, you're ready to get started.

Create a new-branch

Use a separate branch for each feature or issue you work on. After creating a branch, check it out locally so that any changes you make will be on that branch. Learn more

Update, add, commit, and push changes

Work on the feature and make commits like you would any time you use Git. When ready, push your commits, updating the feature branch on Bitbucket. Learn more

Get your code reviewed

To get feedback on your code, create a pull request in Bitbucket. From there, you can add reviewers and make sure everything is good to go before merging. Learn more

Resolve feedback

Now your colleagues comment and approve. Resolve their comments locally, commit, and push changes to Bitbucket. Your updates appear in the pull request.

Merge your pull request

Before you merge, you may have to resolve merge conflicts if others have made changes to the repo. When your pull request is approved and conflict-free, you can add your code to the master branch. Merge from the pull request in Bitbucket. Learn more

While this page only describes how to use the Feature Branch workflow, its use of branches and pull requests could apply to other processes, including Gitflow. Check out Atlassian's Getting Git Right website for descriptions of Gitflow and other Git workflows.

Still need help?

The Atlassian Community is here for you.