1

We are using Bitbucket cloud and our master branch is protected to disallow any direct pushes.

  1. Once the pull request is approved, Is there a CLI command that can be used to merge the pull request? This is because we would like to increment the version in the master branch right before the merge operation.

  2. Is there a way to allow only specific branches to merge to the master branch?

  3. In the CI-CD process, how(and when) does version bump happen? If directly merging through bitbucket/GitHub dashboard, then how to bump the version right before the merge? We won't do it after the merge because the CICD pipeline starts as soon as there is a change detected in the pipeline, and if version bump was happening through the pipeline, it will just end up in a loop.

Also, we are NOT using bitbucket pipelines.

systemdebt
  • 4,589
  • 10
  • 55
  • 116
  • 1
    Why not create 2 PR's ,First to bump the version in master , and Second to merge the approved pull request ? Also might be worth checking `git hooks` – Dev-vruper Aug 27 '21 at 20:53

1 Answers1

1

My usual solution to this problem is to create a release branch. Then make changes on that branch for the release, such as changing the version number or updating the changelog. Finally merge that release branch into master with the usual PR process.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
  • we have been trying not to have so many branches. We do have develop branch, staging, master. staging and master - rarely updated, develop always way ahead. since not deploying very often to staging/master, it felt like a doable compromise but more branches don't exactly make me happy – systemdebt Aug 27 '21 at 20:23
  • 1
    I agree about limiting long-lived branches. At the same time, I am a proponent creating a branch for any change. This "release branch" I see as similar to a feature branch, which I assume you use for your normal work. This would just prepare for an actual release. Once you merge it into master, you can delete it. – Code-Apprentice Aug 27 '21 at 23:02