4

I was working on an issue linked to a gitlab merge-request that I completed but I haven't been able to do it yet (I have to wait for some colleague to get free to review).

Now while I wait I should start working on a new issue but, to develop the functionality of this second issue, I need the files committed in the first issue.

So I decided to continue working on the same merge request and then review both at the same time.

I am sure there is a way to mark on gitlab that that merge request closes both issues but I don't remember how to do it and I have some problem finding such a specific operation on the gitlab documentation!

example of a merge-request closing 2 issues:

enter image description here

  • Issue trackers are not part of Git. Whatever GitLab does is up to GitLab. – torek Apr 09 '21 at 10:53
  • 6
    You can write "Close , Close " in your MR-description or in your commit-message (https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically / https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#default-closing-pattern) – Jakob Liskow Apr 09 '21 at 20:09
  • 1
    Thank you very mutch Jakob! That's exactly what I was looking for. – Lorenzo Piersante Apr 10 '21 at 08:32

1 Answers1

4

The answer of Jakob Liskow in the comments is correct.

Here, the extended version (according to GitLab docs). When using GitLab merge requests:

If a commit message or merge request description contains text matching the defined pattern, all issues referenced in the matched text are closed when either:

The commit is pushed to a project’s default branch.
The commit or merge request is merged into the default branch. 

For example, if you include Closes #4, #6, Related to #5 in a merge request description:

Issues #4 and #6 are closed automatically when the MR is merged.
Issue #5 is marked as a related issue, but it’s not closed automatically. 

Alternatively, when you create a merge request from an issue, it inherits the issue’s milestone and labels.

For performance reasons, automatic issue closing is disabled for the very first push from an existing repository.

idichekop
  • 370
  • 1
  • 6