Hacker News new | past | comments | ask | show | jobs | submit login

GitLab team member here, thanks for sharing!

You can also set Git push options understood by the GitLab server to create merge requests [0] on the CLI.

Sid's dotfiles provide an example in [1]. The workflow is 1) push 2) create merge request 3) set target (master/main) 4) merge when the pipeline succeeds.

alias mwps='git push -u origin -o merge_request.create -o merge_request.target=main -o merge_request.merge_when_pipeline_succeeds' # mwps NAME_OF_BRANCH

There are more push options, such as setting the MR as draft, add labels, milestones, assignees, etc. My personal favorite: Remove the source branch when the MR is merged. That's a project setting too, but sometimes not set. Using the push options, you can force this behavior and avoid stale Git branches.

glab as CLI tool provides a similar functionality to create an MR. Its development has been moved to this project [2]

[0] https://docs.gitlab.com/ee/user/project/push_options.html#pu...

[1] https://gitlab.com/sytses/dotfiles/-/blob/master/git/aliases...

[2] https://gitlab.com/gitlab-org/cli




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: