Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I would like to enforce a merge strategy on a per-branch basis in Bitbucket

I can enforce a merge strategy per project, but we need to change the merge strategy at the branch level. We can allow multiple strategies, but the person who does the merge has to be diligent in selecting the correct one. This is most problematic when merging a long-running development branch into our master branch. We squash PR's to the development branch, but we don't want the PR from development to master to be squashed. Relying on the person who is charged with merging from development to master to make that proper choice has not worked out so well for us.

How can we enforce a merge strategy on a per-branch basis?

2 answers

Our free add-on, Control Freak for Bitbucket Server, might be able to help you with this specific situation.

For the repo in question, set the following config:

Repo --> Settings --> Control Freak

Require Squashed Merges Into:

Override: Yes

[x] Default   [x] Development   [x] Production   [x] Release Branches

 

And then click "Save Settings."

The neat thing about this setting is that while it forces squashes for all merges coming into those branches (based on the repo's branching model), merges *between* those branches do not require squashes.

You might also want to set Control Freak's "Require Fast-Forwardable Merges Into:" setting for the same branches, to force a squash + rebase workflow.

This looks *really* good. Demo-ing it right now.

I'm optimistic that it will get us where we need to be. Thanks vv much!

It works particularly well with our other paid add-on, Bit-Booster Rebase Squash Amend, since that one puts a "Squash" button right on the pull-request screen.

Email us any time at: support@bit-booster.com.

Note:  there's a bit of an implied assumption in the Control-Freak solution for this problem.  The implied assumption is that "--ff" merge is your default merge option (not "--ff-only"), since it will nicely accept the "fast-forward" on the squash, but nonetheless allow the regular merge for the longer lived branches.

BUT if you've set "--ff" to your default merge option, then you really want to disable foxtrot merges as well, because "--ff" merges and foxtrots make a mess of the commit graph.

LUCKILY Control-Freak has that covered:

Block Foxtrot Merges On:

[x] Default   [x] Development   [x] Production   [x] Release Branches [x] Hotfix Branches 
[x] Bugfix Branches   [x] Feature Branches   [x] All Others

(We recommend enabling this block for all branches).

Any built in support for this in Bibucket Server?  We also need to prevent squashes to certain branches, as squashes of branches that contain squashes are REALLY bad and cause of lots of merge headaches.


It's really the only deficiency in Bitbucket that we come across.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you