Skip to content

GitLab: use merge request dependency for stacked MRs #8211

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

Open
nolith opened this issue Apr 18, 2025 · 2 comments
Open

GitLab: use merge request dependency for stacked MRs #8211

nolith opened this issue Apr 18, 2025 · 2 comments
Labels
enhancement An improvement to an existing feature

Comments

@nolith
Copy link
Contributor

nolith commented Apr 18, 2025

I enjoy the stacked branches feature, now that PRs landed on GitLab I can see a missing feature compared to what I used to do in the past when I had to create my merge requests manually.

In GitLab (Premium and Ultimate) you can declare merge request dependencies. When creating a stack I set each MR as depending on the one before.

The effect of this is that you must merge the stack from the bottom, and as you merge each MR, the next one will automatically change its target branch from the previous MR to the default branch.

MR dependencies can be set with a simple API call and it will return a 403 error if the project doesn't have at least a Premium license.

@Byron Byron added the enhancement An improvement to an existing feature label Apr 18, 2025
@Byron
Copy link
Collaborator

Byron commented Apr 18, 2025

Thanks so much for sharing, using this feature would make stacked PRs quite a bit more convenient on GitLab.

Making such an API call and making it optional (as in "may fail silently") should do the trick.

@nolith
Copy link
Contributor Author

nolith commented Apr 22, 2025

@Byron I took a deeper look at this matter and there is another element that is necessary to make stacked MRs work as intended (on GitLab). We also need to auto-remove the branch when the MR is merged, it's just an API parameter for the MR creation #8222

So when you merge the first MR in a stack, it will auto-delete the source branch and trigger an update of the next MR in the stack to target the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants