Close Gitlab issue via commit

According to this link from gitlab, you will be able to do that with a variety of words such as "fixes" or "closes". It does not need to be in a seperate line.

So you could have the following message:

Fixes #20. I had to replace "foo" with "bar".

And that will close issue #20.


Commit and push using this syntax:

git commit -m "Sort more efficiently" -m "Closes #843"
git push

This will commit and close the issue.
Note that unlike Github a single -m will not work.
The following will appear on the issue page:

enter image description here

References:

  • https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically
  • How to commit a change with both "message" and "description" from the command line?

Tags:

Gitlab