Note that pushing to GitLab requires write access to this repository.
Note that pushing to GitLab requires write access to this repository.
%p
%p
%strong Tip:
%strong Tip:
You can also checkout merge requests locally by
=succeed'.'do
%a{href: 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/workflow/merge_requests.md#checkout-merge-requests-locally',target: '_blank'} following these guidelines
You can also checkout merge requests locally by
=link_to'following these guidelines',help_page_path('user/project/merge_requests.md',anchor: "checkout-merge-requests-locally"),target: '_blank'
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:
Now you can check out a particular merge request from any repository and any
remote. For example, to check out the merge request with ID 5 as shown in GitLab
from the `upstream` remote, do:
```
```
$ git mr upstream 5
git mr upstream 5
```
```
This will fetch the merge request into a local `mr-upstream-5` branch and check it out.
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
#### Checkout locally by modifying `.git/config` for a given repository
Locate the section for your GitLab remote in the `.git/config` file. It looks like this:
Locate the section for your GitLab remote in the `.git/config` file. It looks
like this:
```
```
[remote "origin"]
[remote "origin"]
...
@@ -32,9 +124,19 @@ Locate the section for your GitLab remote in the `.git/config` file. It looks li
...
@@ -32,9 +124,19 @@ Locate the section for your GitLab remote in the `.git/config` file. It looks li
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/heads/*:refs/remotes/origin/*
```
```
Now add the line `fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*` to this section.