[go: up one dir, main page]

Skip to content

Trigger more than 1 merge request through git push options

Problem to solve

When using Gitflow I need to create 2 merge requests when pushing hotfixes.

I tried to create those 2 branches without gitlab UI by running following commands:

# Hotfix push ja merge request
git push origin HEAD -o merge_request.create -o merge_request.target=master
git push origin HEAD -o merge_request.create -o merge_request.target=development

But second command fails since there's no new changes to push

Intended users

This is useful for Developers which are using the Gitflow workflow.

git-flow (source: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)

Proposal

I think we could add comma separated list into merge_request.target

git push origin HEAD -o merge_request.create -o merge_request.target=development,master

or we could add a new flag merge_request.targets

git push origin HEAD -o merge_request.create -o merge_request.targets=development,master

What does success look like, and how can we measure that?

After Developer pushes the branch to gitlab with merge_request.targets=development,master push option I should see 2 merge requests opened for the project.

User should also see all of the created branches in the output and somehow show which one is which:

$ git push origin hotfix/change-something -o merge_request.create -o merge_request.targets=development,master
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 459 bytes | 24.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote:
remote: View merge request for hotfix/change-something:
remote:   https://my-gitlab.something/team/project/merge_requests/123 (development)
remote:   https://my-gitlab.something/team/project/merge_requests/124 (master)
remote:
To my-gitlab.something:team/project.git
 * [new branch]        HEAD -> hotfix/change-something

Links / references

https://docs.gitlab.com/ee/user/project/merge_requests/#git-push-options

Edited by Tanya Pazitny