How to find all the open branches in a repository
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
This document covers how to list every branch that is open or un-merged in a repository.
Solution
Whether a branch is unmerged or merged is decided with the perspective of the main/master branch. If you are looking for whether a branch is merged into master branch for example, the below command will give you the list of branches -
1 2 3 4 5 6 7 8 9 10
git checkout master (This command will set your current branch to master) git branch --no-merged Sample Output: git branch --no-merged release/feature-123 release/feature-267 QA
You can also skip the checkout and directly enter the branch name as shown below -
1
git branch --no-merged master
However, your local repository copy might not contain all the branches of the remote. Hence, it is better to perform a mirror clone first and then run the above commands on the mirror clone since it will contain all the branches. The below command will help you make a mirror clone -
1
git clone --mirror https://<Bitbucket Username>@bitbucket.org/<Workspace ID>/<Repository Name>.git
Was this helpful?