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?
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.
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.
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.
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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With