How to create a GitLab merge request via command line

后端 未结 9 1113
清酒与你
清酒与你 2020-12-13 23:49

We are working on integrating GitLab (enterprise edition) in our tooling, but one thing that is still on our wishlist is to create a merge request in GitLab via a command li

9条回答
  •  时光说笑
    2020-12-14 00:11

    You can write a local git alias to open a Gitlab Merge Request creation page in the default browser for the currently checked-out branch.

    [alias]
        lab = "!start https://gitlab.com/path/to/repo/-/merge_requests/new?merge_request%5Bsource_branch%5D=\"$(git rev-parse --abbrev-ref HEAD)\""
    

    (this is a very simple alias for windows; I guess there are equivalent replacements for "start" on linux and fancier aliases that work with github and bitbucket too)

    As well as being able to immediately see&modify the details of the MR, the advantage of this over using the merge_request.create push option is that you don't need your local branch to be behind the remote for it to work.

    You might additionally want to store the alias in the repo itself.

提交回复
热议问题