Automerging from release build back to trunk

I am looking for a good way to automatically merge on push from a release build like release/3.0 back to my main/default branch (in this case it is called dev). The thinking is that I want any change made in a release branch to also be in the dev branch. I looked at the auto merge function from Stash. That appears to only merge downstream to later release branches, but not upstream to the dev branch.

My next thought was to use the auto merge feature in bamboo, as I am already doing a build on each push. The problem there is that I don't want to build the merge, I want to run the build on release/3.0, and if successful, then merge release/3.0 into dev, and push to dev, but the build results are just from release/3.0.

The only way I can think to do this is to use a post receive hook to automatically merge any push to release/* to dev. https://blogs.atlassian.com/2013/05/git-automatic-merges-with-server-side-hooks-for-the-win/ explains how to do this. What isn't clear is what happens when the merge has conflicts? Also, if I merge to release/3.0 via a pull request, I'm not sure this would even trigger the post receive hook.

Any ideas?

2 answers

This widget could not be displayed.

I solved this issue by creating a second build plan on bamboo just for doing the merges. It doesn't produce any artifacts, just tests the merge down to dev to see that it merges and builds.

This widget could not be displayed.

Hi Chris,

This sounds exactly like the automerge feature you mentioned. If 'dev' is set as the 'default' branch in the repository it should work. Although currently it only kicks off when a pull request is merged, not when you push to the release branch.

Regarding your question about conflicts - our automerge plugin will raise a pull request and email the original 'author' when that happens. When those conflicts are resolved the merge will continue to be automerged up the release chain until it hits the default branch.

(Doing a merge via a Pull Request does fire a Stash-level AsyncPostReceiveHook, but not an _actual_ Git hook as it wasn't done via a push)

We use automerge in Stash heavily and I couldn't imagine going back to doing it any other way. :)

Cheers,

Charles

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Teamwork

The tools we make for teams? We use them every day at Atlassian to get shit done (and it works).

I’m Jess, a Product Marketer for Jira Software Server and Data Center, and now a huge fan of our products. Read on for a 90 day, new-hire perspective on what it’s like to standardize on the Atlassian...

38 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you