Automatic merge of pull requests on Github without the merge bubble
Asked Answered
T

2

39

The "This pull request can be automatically merged [Merge pull request]" button in github is great -- except that it creates merge bubbles.

Is there a way to use this button/functionality in github without it creating merge bubbles?

Taddeo answered 3/4, 2012 at 13:17 Comment(2)
Not sure I've ever heard the term "bubble" before (in relation to git); I'm assuming it means "commit"?Gisellegish
@Gisellegish Please google "merge bubble". :)Taddeo
T
3

And.. they fixed it!

See GitHub's blog on squashing your merge commits

If you go to the settings for your repository, you'll see a "Merge Button" section (under Options). It will have 2 buttons available:

Allow merge commits
Add all commits from the head branch to the base branch with a merge commit.

and

Allow squash merging
Combine all commits from the head branch into a single commit in the base branch.

If you uncheck the first option (and left the Allow squash merging checked), PR "merges" will result in rebase and squashes.

Taddeo answered 8/4, 2016 at 16:9 Comment(3)
Except that squash is not equivalent to rebase + fast-forward merge in the case where you have several commits that you want to keep separate...Capuchin
@FlorentGuillaume You're absolutely correct! Unfortunately, that has nothing to do with avoiding a merge bubble or not. ;DTaddeo
I'm just saying that Allow squash merging has (obvious) side effects besides avoiding merge bubbles.Capuchin
M
40

No.

The git blog says using this button you always get an --no-ff merge (no fast-forward merge).

You'd have to do a manual merge if you don't want merge bubbles:

git checkout master
git remote add cameronmcefee git://github.com/cameronmcefee/Spoon-Knife.git
git fetch cameronmcefee 
git merge cameronmcefee/my-branch
git push origin master
Mandy answered 8/6, 2012 at 9:17 Comment(3)
You can set up your repo to fetch pull requests without adding a remote: help.github.com/articles/checking-out-pull-requests-locallyJohppa
we did simple automation to do fast-forward merge on github github.com/checkstyle/checkstyle/blob/master/…Makeup
What is the reason for --no-ff in this case?Jaime
T
3

And.. they fixed it!

See GitHub's blog on squashing your merge commits

If you go to the settings for your repository, you'll see a "Merge Button" section (under Options). It will have 2 buttons available:

Allow merge commits
Add all commits from the head branch to the base branch with a merge commit.

and

Allow squash merging
Combine all commits from the head branch into a single commit in the base branch.

If you uncheck the first option (and left the Allow squash merging checked), PR "merges" will result in rebase and squashes.

Taddeo answered 8/4, 2016 at 16:9 Comment(3)
Except that squash is not equivalent to rebase + fast-forward merge in the case where you have several commits that you want to keep separate...Capuchin
@FlorentGuillaume You're absolutely correct! Unfortunately, that has nothing to do with avoiding a merge bubble or not. ;DTaddeo
I'm just saying that Allow squash merging has (obvious) side effects besides avoiding merge bubbles.Capuchin

© 2022 - 2024 — McMap. All rights reserved.