How to merge changes to different branches without previous merges

Murat Gür February 22, 2022

We have two branches

  • develop
  • master

We are working on the "develop" branch with PR. Each developer gets "pull" from the "develop" branch and creates a new branch let's say feature/item-1 and merges back to the "develop" with PR and at least 1 approval rule. This works fine.

After that, we deploy the "develop" branch to our testing servers so the QA team can test if the development is ok or not.

What we trying to figure out: After a branch that is merged, tested, and accepted by the QA, we want to merge this branch into the "release" branch but without getting all the differences between "development" and "release" branches. Right now if we crate the PR "feature/item-1" branch into the "release" branch it includes the past commits from the "develop" branch which we don't want because it includes the commits not tested.

We may use cherry-pick the branch into "release" but and the end of the day we are using bitbucket and there must be a solution, right? :D

1 answer

1 vote
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 25, 2022

Hi, @Murat Gür, thank you for reaching out to Atlassian Community.

Usually, when using git/pull requests, we would only merge in branch/commits into the 'develop' branch after it is tested, rather than merging everything into a singular branch to then be tested at that point. This would allow you to only have good/valid commits in the develop branch, meaning that you can then merge from that branch to main whenever you're ready to build/publish the changes as a new version of the application.

To give you some context, with git in general, the idea is to keep branches healthy by only merging once you know content is ready. Merging any commits/branches into a universal testing branch isn't a common practice and isn't something we often see so unfortunately we don't have any tools or common methods to help guide you with your workflow as it exists today (except cherry-pick as you mentioned).

With this in mind, we typically see developers pushing to branches with a specific pattern like "feature/name-of-feature" so that the pattern of "feature/*" can be tested against with the same build/test phase as discussed in this article. I would also like to suggest that you take a look at Git Feature Branch Workflow and check if this workflow could help you and your team.

I hope this helps, but do let me know if you have any questions. 

Kind regards,
Caroline

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events