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

Git, your way: Expanded strategies for branch sync and merge

This feature update was also posted on the Bitbucket blog.

By popular demand, we are happy to introduce several new strategies for syncing and merging branches in Bitbucket Cloud. Our goal is to provide you the full functionality of rebase and merge within the Bitbucket UI to help you manage your Git history according to your team's preferences.

These new options have been among our most highly voted feature requests. In brief, here's what we've added:

  • A rebase sync option for when your pull request has fallen behind the target branch.
  • New options when it's time to merge your PR: rebase + merge, rebase + fast forward, and squash (fast forward only).

 

Sync via rebase

Until today, when a source branch is missing commits from the target branch, Bitbucket has only offered the option to merge the target branch back into the source branch by creating a merge commit. Merge commits add a new commit on your source branch history, which can make the Git history noisy and difficult to track.

For teams that prefer a "cleaner" commit history, the new option to rebase sync (previously possible only from the command line) enables you to rewrite the commit history with the latest updates from the source branch.

01 What is git rebase.png

To do a rebase, look for the message on your pull request that a sync is available:

sync-message.png

After selecting "Sync now", you can choose between a merge commit or a rebase:

sync-strategy.png

Why would you choose to sync via rebase versus merge commit? It's a matter of your team (or personal) preference about maintaining branch history. To learn more about rebasing, check out Atlassian's Git tutorial.

 

Expanded merge strategies

Merge strategies define how the commit history appears when you merge a completed pull request into the target branch. Historically, Bitbucket Cloud has supported merging via merge commit, squash, and fast-forward. Today we've added three additional strategies: rebase + merge, rebase + fast forward, and squash (fast forward only). You'll find the new merge strategy options in the same place as the existing ones – in the pull request merge dialog:

merge-strategy.png

Admins can set the default strategy for pull requests in Project settings or Repository settings > Merge strategies.

Bitbucket's documentation on merging a pull request has details on how all these strategies work.

 

We hear you ❤️

If you have any feedback – good or bad – about these new merge & sync options, please head to the Bitbucket help menu > Give feedback to share your thoughts with us.

 

PS: Coming very soon to a pull request near you: 🌓 dark mode!

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events