Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase PR when base branch is merged #544

Open
nmattia opened this issue Nov 26, 2019 · 6 comments
Open

Rebase PR when base branch is merged #544

nmattia opened this issue Nov 26, 2019 · 6 comments

Comments

@nmattia
Copy link

nmattia commented Nov 26, 2019

Related to #291

Say PR 42 has branch base and PR 43 uses base as base branch. It would be great to have PR 43 be rebased on master automatically when PR 42 is merged.

@jd
Copy link
Member

jd commented Nov 26, 2019

That's something that can be done with the rebase action: https://doc.mergify.io/actions.html#rebase

The trick is just to set the conditions properly. What should be the criteria for rebasing a PR? (at least in your case).

@nmattia
Copy link
Author

nmattia commented Nov 26, 2019

What should be the criteria for rebasing a PR?

Here the issue is that the base branch would change. Ideally PR 43 would be based against master once base has been merged. Would this be possible?

@jd
Copy link
Member

jd commented Nov 27, 2019

The rebase action rebase on top of the target branch, not the base branch. So if both PR targets master, rebasing PR43 will rebase on top of master which now has PR42 in it — which is what you want IIUC.

My main concern here is still how you want to express the rebase conditions. Alternatively, you can trigger the rebase manually with the rebase command: https://doc.mergify.io/commands.html#rebase

@nomeata
Copy link

nomeata commented Nov 28, 2019

Let me rephrase the request (assuming I got it right):

We have PR42 wanting to merge feature into master, and PR 43 wanting to mege subfeature into feature (not master).

Now PR42 is merged in to master.

What now should happen automatically is that the base branch of PR43 is changed from feature to master, so that PR43 now wants to merge subfeature into master.

(This now incidentially allows delete_head_branch, if configured, to delete feature.)

This is all orthogonal to how the merges are done (rebase, squash, normal).

@jd
Copy link
Member

jd commented Nov 28, 2019

That's now what I understood, but if that's the case, you'd first need an action that allows you to change the base branch of a PR. We don't have it yet, but that should be straightforward to implement.

The conditions to have this action triggered are more tricky though. 🤔

@thomaseizinger
Copy link

Github recently released something that helps with this if I understand correctly: https://github.blog/changelog/2020-05-19-pull-request-retargeting/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants