How to change branch from 'Active branch' status to 'Merged branch'
Asked by Juan Sebastian Marin:

Good morning,

I would like to know how I can change a branch after merging it with the main branch so that it appears in the 'Merged Branches' filter and not in 'Active branches'

Despite creating a pull request or performing a direct merge, the merged branch always remains in the 'Active branch' filter and I want it to only be visible from 'Merged branches' once merged, but I can't find a solution

I appreciate the information you can provide me.


Answers:
author: Theodora Boudale
body: Hi [@Juan Sebastian Marin](/t5/user/viewprofilepage/user-id/5161502) and welcome to the community!

Any branch that shares history with the repository's main branch but is ahead of the repository's main branch by some commits that are not yet present within the main branch, is considered an active branch. If you merge branchA into the main branch with a merge commit, then branchA should move to Merged branches.

1. What kind of merge strategy are you using when merging a PR? Is it merge commit, squash, or fast-forward?
2. Are you indeed merging into the repo's main branch, as listed on the **Branches** page of the repo?
3. After you merge a branch: when you look at the **Branches** page, what does the **Ahead** column show for the branch you merged?
4. If you select the 3 dots in **Actions** for the branch you merged \> select **Compare** , does the **Commits** tab show any commits on this compare page (make sure that the compare is done between the branches you merged)?

Kind regards,  
Theodora

comments: author: Ahmad Khatoun
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) Essentially your software is forcing users to use Fast Foward or delete branches to be able to organize branches in any meaningful way.

Is there any way to override what counts as active or perhaps organize by git tag?

This is extremely frustrating, since we're forced to delete branches that may have valuable information or deal with uncertainty regarding which branches are still active


author: Theodora Boudale
body: Hi Ahmad and welcome to the community.

I'm afraid that there is no way to override what counts as an active branch or organize by tags. It is possible to filter by branch type (next to the Active branches filter) if you use certain prefixes for your branches. These prefixes can be configured by admins in the page **Repository settings \> Branching model**.

What merge strategy do you use? Using the merge commit strategy will also make the branch appear in Merged branches. However, if you use the Squash strategy, the branch will still show as Active.

Kind regards,  
Theodora


author: Ahmad Khatoun
body: Yes, I'm aware the Squash strategy will still show as Active. That's what my point is here.

I'm aware I can filter by prefixes and can set those in the Branching model.

However that creates an issue where branches have to constantly be renamed and their may be a disconnect with local versions.

Currently we have to rely on tags, which works okay enough, but still creates disparities with local versions of the repo if users aren't regularly pruning \& fetching tags.


author: Theodora Boudale
body: Hi Ahmad,

We have a feature request to show branches merged with the Squash strategy in the Merged branches:

* <https://jira.atlassian.com/browse/BCLOUD-22398>

Since you'd be interested in that, I would suggest adding your vote to that request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features.

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Kind regards,  
Theodora


author: Ahmad Khatoun
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) My interest is not in seeing which branches are merged.

As I mentioned above, my interest is in filtering out branches that haven't been merged or haven't been modified in a while.

The only affect displaying squash merge branches in "merged", while not excluding them from active does, is make both useless. If all of my branches are in both "active" and "merged" (regardless of what branches they were merged into), then neither have any relevant meaning (which is the OP's original point).

If I want to see which branches are merged, I have several better ways I can already do that. Notably looking at old PRs targeting specific branches, searching for merge commits, etc....

This is one of the reasons to use squash merges in the first place. The majority (usually only) commits on the development branches and main branches, are all merges, making it easy for me to track the actual state of my environments through time.

I'm not asking for a future solution that may be implemented (which [BCLOUD-22398](https://jira.atlassian.com/browse/BCLOUD-22398) isn't either) , I'm asking if there is a current solution that I am not aware of. It seems the answer is no, there isn't an existing solutions to this issue, which is fine.


author: Theodora Boudale
body: Hi Ahmad,

I'm sorry if my previous replies were not clear. Indeed, at the moment there is no way of filtering out branches that haven't been merged yet to the repo's main branch if you use the squash merge strategy.

The feature request concerns showing branches merged with Squash in Merged branches instead of Active, which I why I shared it.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud