The Bitbucket team uses Git’s branch and merge features religiously with pull requests for code review. At any given time we may have a dozen open pull requests for code that is looking to be merged into our staging branch, which later gets promoted to our production branch and deployed to bitbucket.org.
With so much in code in flight, keeping track of which branches are open, active, or gone stale can be a hassle. This got us thinking during our recent Innovation Week, “What if there was a way to review open branches that need to be pulled?”
Introducing a new way to see branches
With the new “Feature branches” commit listing, you can now see branched commits that are ahead of your main branch. This new view allows you to:
- get a sense of team activity
- compare and create pull requests for open branches
- find stale branches that need to be reviewed or closed
- view an open pull request for a branch
Branching is easy with Git
Creating branches, working on them, and merging your changes is effortless. To get started, simply clone your repository and create a feature branch:
git checkout -b my_new_branch
Make some changes and when you are done, push your changes:
git push origin my_new_branch
Your branch will now show up on the “Feature Branches” view for everyone to see. Next you’ll want to share your branch with your team by creating a pull request to conduct a code review.
Closing branches with pull requests
The simplest way to close a branch with pull requests is to use the close branch option when creating a pull request.
When selecting this option, Bitbucket will automatically close the source branch for you, tidying up your team's repository and “Feature branches” view.