Question about BitBucket Plugin "PR Squash"

When merging a pull request into master branch, does this plugin provide an option to rebase onto master rather than the normal merge? Normal merge will introduce an unnecessary "merge" commit and a small loop in the revision history (see below). Is it possible to make the history of master branch 100% linear using this plugin? In another word, can we get rid of the "Merge Pull Request ##" commit using it?

 

image2017-1-3 18:7:33.png

1 answer

I recommend my add-on for squashing pull-requests (Bit-Booster for Bitbucket Server).

Once you've squashed you can later merge with "--ff-only" if you're on Bitbucket 4.9 or newer and your repo's settings allow such:

(repo --> settings --> pull requests --> merge strategies --> [x] Fast-forward only --ff-only).

Here's a screenshot of Bit-Booster's Squash button on the pull-request screen. Notice it also let's you select the author for the final squashed commit:

squash-latest.png

Here's a source branch before it's squashed:

step1-before-dia.png

 

My add-on pushes the squash back to the source branch (using "git push --force").  It doesn't touch the "master" branch (or whatever branch your PR is targeting). Instead it let's you edit your source branch according to your needs before you merge:

step3-after.png

 

If you're on Bitbucket 4.9 or newer, make the "[x] Fast-forward only" merge strategy available in your reposistory's settings.  That way you can merge like this:

step4-ff-only.png

 

The final result pops that commit directly on top of you "master" branch, without any merge commit:

step5-merged.png

 

p.s.  All of the commit graphs come from the "All Branches Graph" feature of my add-on (Bit-Booster for Bitbucket Server).

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

365 views 0 6
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