Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close GitLab CE Merge Requests From Commit Message

A useful feature of GitHub is that users are able to close their "pull requests" (PRs) via commit message. For instance, if Closes #1 is written in a commit message and that commit subsequently lands on the master branch, GitHub will automatically close the PR.

GitLab has a similar setup, but the pull requests are known as "merge requests" (MRs). Although I have found support for the automatic-PR-closing feature in GitHub, it appears as though GitLab is completely devoid of this useful feature. The only way to close merge requests (that I've found) is by manually clicking the "Accept" or "Close" buttons on GitLab itself.

This SO question illustrates the feature in question.

And yes, I'm aware that you can close issues, as stated here: http://docs.gitlab.com/ee/customization/issue_closing.html

But as that page says:

When a commit or merge request resolves one or more issues, it is possible to automatically have these issues closed when the commit or merge request lands in the project's default branch.

So only issues will be closed if a MR or a commit lands in master, but it doesn't speak to the closing of MRs if a commit lands in master.

I searched through the GitLab-CE repo's issues and came up empty handed. Is this just a poorly documented feature, or does GitLab CE simply not support this?

like image 628
Kenny Worden Avatar asked Aug 08 '16 11:08

Kenny Worden


People also ask

What happens when you close a merge request in GitLab?

In Gitlab, the merged status means the relevant commits have been merged and no action is needed. A closed merge request is one that has been put aside or considered irrelevant. It is therefore not merged into the code base.

How do I stop a merge request?

Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.

How do you make a commit on a merge request on GitLab?

In the Commit message, enter a reason for the commit. Select the Target branch or create a new branch by typing the name (without spaces, capital letters, or special chars). Select the Start a new merge request with these changes checkbox or toggle.

How do you close a merge request in GitLab?

Even though that is exactly what gilab produces - to close a merge request (successfully) one has to write "Closes !X" in the commit message. copy the gitlab behaviour of writing "See merge request !X" in the commit message What is the current bug behavior?

How do I change the issue closing pattern in GitLab?

There is a separate user documentation on issue closing pattern. When a commit or merge request resolves one or more issues, it is possible to automatically close these issues when the commit or merge request lands in the project’s default branch. In order to change the pattern you need to have access to the server that GitLab is installed on.

What is a merge request in Git?

Merge requests (MRs) are the way you check source code changes into a branch. When you open a merge request, you can visualize and collaborate on the code changes before merge. Merge requests include: A description of the request. Code changes and inline code reviews.

How do I stop work on a merge request?

If you decide to permanently stop work on a merge request, GitLab recommends you close the merge request rather than delete it. The author and assignees of a merge request, and users with Developer, Maintainer, or Owner roles in a project can close merge requests in the project: Go to the merge request you want to close.


1 Answers

Evidently it is not supported as of GitLab version 9.1.1.

There is a GitLab CE issue currently open requesting that feature. If you want it, you can log on and vote for it.

  • Close merge request with commit message
like image 170
Wildcard Avatar answered Sep 30 '22 08:09

Wildcard