How to checkout merge request locally, and create new local branch?

后端 未结 4 1228
故里飘歌
故里飘歌 2021-01-31 18:14

I have GitLab repository there and I need to test every merge request locally, before merging to the target branch.

How can I pull/fetch merge request as a new branch?<

4条回答
  •  再見小時候
    2021-01-31 18:37

    This is also documented in GitLab online documentation : https://gitlab.com/help/user/project/merge_requests/index.md#checkout-merge-requests-locally

    They supply this script (git alias) :

    [alias]
        mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
    

    Then you can use this command :

    git mr origin 4

    So a new local branch mr-origin-4 will be created.

提交回复
热议问题