Skip to main content
← All posts

Create a merge request that doesn't close the issue

Create merge request on a GitLab card writes Closes #12 into the new merge request, the same as GitLab's own button. Merge it and GitLab closes the issue.

That's right most of the time. It's wrong when the merge is only part of the job: the first of several merge requests, a change that still needs a migration run or a docs update afterwards, or a fix that someone has to check in production before the issue can close.

The new box

The dialog now has a box, ticked by default: Close #12 when this merges. Untick it, and the merge request says refs #12 instead. It still belongs to the issue, and it stays on the card with its pipeline, approvals and conflicts. But merging it leaves the issue open.

If your board's merge request keywords don't include refs but do include Related to, the merge request says Related to #12. Either way, GitGumbo only writes a keyword your board links, so the merge request never drops off its own card at the next sync.

When there's no box

The box only appears when it can do what it says:

  • The project doesn't close issues on merge. If the project has "Auto-close referenced issues on default branch" turned off, a ticked box would be a promise GitLab won't keep, so there's no box. The issue stays open whatever the merge request says.
  • The board links no non-closing keyword. Unticking would leave the merge request off the card, so the dialog doesn't offer it, and the merge request says Closes #12.

That first case also fixes an older problem. On a project that doesn't close issues on merge, the merge request used to say Related to #12, and a board with the default keywords didn't link that. The card lost the merge request it had just created. It now gets a keyword the board links.

GitHub cards are unchanged: Create pull request has no box yet.

The Reading a card guide covers every option in the dialog.