Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-10 22:39:25 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-10 22:39:25 +0300
commit5ef196621e6b16409d15c8df6833abad4ceefc7d (patch)
treeb099c5763a3c0bffecb5660b9bc52d4ec2691ada /app/views/projects/merge_requests
parentf56541de9a488dec68f4e98f738f90c51d898fc9 (diff)
parent88d397f473a40236c7a03a7acf924a3640e70d9c (diff)
Merge branch 'better-mr-instructions' into 'master'
Better merge request manual instructions I noticed the current instructions for manually merging a merge request that was submitted from a fork could create unnecessary merge requests or strange history. Imagine this: 1. Alice creates a repository and commits / pushes a single commit with SHA1 `A` to `master`. 2. Bob forks this repository and creates a new branch `myfeature` on `master` (`A`) 3. Alice commits `B` to `master` (which has the parent `A`) 4. Bob creates two commits on `myfeature` `P` and `Q`. 5. Bob submits the merge request to merge his `myfeature` into Alice's `master` branch. 6. Alice follows the manual merge request instructions: 1. `git checkout -b bob/repo-myfeature master` 2. `git pull http://... myfeature` The branch `bob/repo-myfeature` was created from Alice's current `master`, which was `B`. When the `pull` is executed, git will fetch Bob's branch and then merged the fetched branch `Q` into the current branch's location `B`. This creates an unnecessary merge commit from `master` into the branch Alice is trying to merge. No harm is done, but the history is a bit messier. This is even worse if Alice has set `git pull` to rebase by default. In this case, the commit `B` is rebased on top of `Q`. When Alice checks out `master` and merges in the branch, there will actually be a duplicate `B` commit. These new instructions instead tell the user to fetch Bob's `myfeature` branch. This will fetch the necessary commits `P` and `Q` and create a temporary ref `FETCH_HEAD` pointing to `Q`. Alice will then create her local `bob/repo-myfeature` branch starting at `FETCH_HEAD`. No unnecessary merge commits, and no accidental rebasing. See merge request !16
Diffstat (limited to 'app/views/projects/merge_requests')
-rw-r--r--app/views/projects/merge_requests/show/_how_to_merge.html.haml6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/views/projects/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml
index 9540453ce3e..63db4b30968 100644
--- a/app/views/projects/merge_requests/show/_how_to_merge.html.haml
+++ b/app/views/projects/merge_requests/show/_how_to_merge.html.haml
@@ -10,11 +10,11 @@
- target_remote = @merge_request.target_project.namespace.nil? ? "target" :@merge_request.target_project.namespace.path
%p
%strong Step 1.
- Checkout the branch we are going to merge and pull in the code
+ Fetch the code and create a new branch pointing to it
%pre.dark
:preserve
- git checkout -b #{@merge_request.source_project_path}-#{@merge_request.source_branch} #{@merge_request.target_branch}
- git pull #{@merge_request.source_project.http_url_to_repo} #{@merge_request.source_branch}
+ git fetch #{@merge_request.source_project.http_url_to_repo} #{@merge_request.source_branch}
+ git checkout -b #{@merge_request.source_project_path}-#{@merge_request.source_branch} FETCH_HEAD
%p
%strong Step 2.
Merge the branch and push the changes to GitLab