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

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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Agile

How Davin Studer gets Confluence to do everything he wants it to do...except dishes

  @Davin Studer holds many interests, including but not limited to health tech and Star Trek. Read on to discover more about Davin, from his favorite Confluence macros to his favorite lit...

177 views 1 8
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