gitgitlabgit-merge

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


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?


Solution

    1. Pull merge request to new branch

      git fetch origin merge-requests/REQUESTID/head:BRANCHNAME

      e.g. git fetch origin merge-requests/10/head:file_upload

    2. Checkout to newly created branch

      git checkout BRANCHNAME

      e.g. ( git checkout file_upload)

    OR with single command

    git fetch origin merge-requests/REQUESTID/head:BRANCHNAME && git checkout BRANCHNAME

    e.g. git fetch origin merge-requests/18/head:file_upload && git checkout file_upload