summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2016-08-24 18:19:04 +0000
committerAchilleas Pipinellis <axilleas@axilleas.me>2016-08-24 18:19:04 +0000
commit7b0b2417491e28e5536688e0fca96829a4cb7900 (patch)
tree45fac6c334f3433edc5f3b970e603162a05b6420
parentb13dba7f25170e2f4d0b9a092c3a47851a504f48 (diff)
parenta7bd1c23dd03f00d10b0ff4db655690283e2f88a (diff)
downloadgitlab-ce-7b0b2417491e28e5536688e0fca96829a4cb7900.tar.gz
Merge branch 'patch-4' into 'master'
Update merge_requests.md with a simpler way to check out a merge request ## What does this MR do? This MR updates `merge_requests.md` with a simpler way to check out a merge request The previous way was put under the "By modifying `.git/config` for a given repository" section. The disadvantage of the old way is that one has to modify `.git/config` for each repository that one uses. The new way was put under the "By adding a git alias" section. One has to create this git alias once, and then it will work from any repository, without having to modify `.git/config` over and over again. ## Are there points in the code the reviewer needs to double check? One should double check that the link provided by the "Check out branch" button in a MR, i.e. https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/workflow/merge_requests.md#checkout-merge-requests-locally, still works. I think it will, since I didn't modify the "Checkout merge requests locally" section name. ## Why was this MR needed? This MR was needed because the old way of checking out a merge request locally requires to modify `.git/config` in all repositories that one has on a computer, which is a tedious task. The new way just requires adding a simple git alias, once. And the `git mr` command then works for all repositories. ## What are the relevant issue numbers? I haven't created an issue for this. ## Screenshots (if relevant) N/A ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added (N/A) - Tests - [ ] Added for this feature/bug (N/A) - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5944
-rw-r--r--CHANGELOG1
-rw-r--r--doc/workflow/merge_requests.md19
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:
```