diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | doc/workflow/merge_requests.md | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG index 0383f33a6ef..3e6066cfae0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -175,6 +175,7 @@ v 8.11.0 - Eliminate unneeded calls to Repository#blob_at when listing commits with no path - Update gitlab_git gem to 10.4.7 - Simplify SQL queries of marking a todo as done + - Update merge_requests.md with a simpler way to check out a merge request. !5944 v 8.10.7 - Upgrade Hamlit to 2.6.1. !5873 diff --git a/doc/workflow/merge_requests.md b/doc/workflow/merge_requests.md index d2ec56e6504..91fcfb02d39 100644 --- a/doc/workflow/merge_requests.md +++ b/doc/workflow/merge_requests.md @@ -15,6 +15,25 @@ Please note that you need to have builds configured to enable this feature. ## Checkout merge requests locally +### By adding a git alias + +Add the following alias to your `~/.gitconfig`: + +``` +[alias] + mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' - +``` + +Now you can check out a particular merge request from any repository and any remote, e.g. to check out a merge request number 5 as shown in GitLab from the `upstream` remote, do: + +``` +$ git mr upstream 5 +``` + +This will fetch the merge request into a local `mr-upstream-5` branch and check it out. + +### By modifying `.git/config` for a given repository + Locate the section for your GitLab remote in the `.git/config` file. It looks like this: ``` |