GitLab: Resolve commits not updated in merge request

Source: Internet
Author: User

Code Review has recently been used with the Merge requests feature of GitLab. The operation flow is this:

1) Developer A to add a new feature to a project, first create a Git branch on this project.

2) After the development is complete, git push to this branch.

3) Then create a merge Request in the merge requests, and then specify developer B for Code Review.

4) Developer B issues a problem in code Review and requires developer A to modify the code.

5) Developer a modifies the code and push it to this branch.

6) Developer B continues with Code Review, and if no problem is found, merge this branch into the trunk on the "Accept merge Request".

In the process of code Review, we encountered a strange problem in 第5-6: developer A does not see the latest Commit in the Merge Request when developer A is on the push-to-branch, in code Review.

For example, you only see 6 commits in the Merge Request, but actually there are 7, and you can see 7 on the GitLab commits page.

At that time helpless. Later, close the merge request and recreate the new merge request to see the latest Commit. But after git commits and push again, you still don't see the latest commit.

This problem affects the normal conduct of Code Review, it is very depressed. To solve this problem today, try to upgrade GitLab to the latest version (the server operating system is CentOS).

The upgrade steps are as follows:

1) Find the latest Gitlab RPM package in Https://packages.gitlab.com/gitlab/gitlab-ce and download it with wget.

2) Stop GitLab related services:

sudo gitlab-ctl stop unicornsudo gitlab-ctl stop Sidekiqsudo gitlab-ctl Stop Nginx

If you want to back up the database, you can use the following command:

sudo gitlab-rake gitlab:backup:create

3) Install the new GitLab

sudo rpm-uvh gitlab-x.x.x_xxx.rpm

4) Refresh Configuration and restart GitLab

sudo gitlab-ctl reconfiguresudo gitlab-ctl restart

After the upgrade, the problem remains ...

After that, try 2 commands to check the GitLab status:

sudo gitlab-ctl statussudo gitlab-rake gitlab:check sanitize=true

After the 1th command executes, the display status is normal.

After the 2nd command executes, the following error occurs:

2/9 ... rake aborted! Errno::enoent:no such file or directory @ Realpath_rec-/gitlab/repos/repositories/cnblogsmsg.git/hooks

At the sight of hooks, there was a light. Hooks folder does not exist, so every time git push operation, GitLab do not know at all (GitLab is learned by the script in the Hooks folder each push operation). Therefore, the Merge Request naturally does not see the latest commits.

Then why does the Hooks folder not exist? It suddenly occurred to me that the code base for this project was migrated to GitLab (see Importing the existing Git project GitLab on the server side), not created in GitLab, and naturally there was no Hooks folder GitLab needed. Then look at the other items created in GitLab, and sure enough, there is a hooks folder.

Knowing the reason, it's easy to solve--Copy the Hooks folder from another project to this project.

After you re-git push, the latest Commit appears.

GitLab: Resolve commits not updated in merge request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.