Typical message looks like:
Merge branch ‘mass-refactoring’ into ‘master’
Mass refactoring
See merge request group/project!13
Is it possible to change template to something like: ?
HEADER
BODY
Merge branch SRC_BRANCH into TGT_BRANCH. See merge-request GROUP/PROJECT!N
You can change the most recent commit message using the git commit --amend command. In Git, the text of the commit message is part of the commit. Changing the commit message will change the commit ID--i.e., the SHA1 checksum that names the commit. Effectively, you are creating a new commit that replaces the old one.
Changing the latest Git commit message If the message to be changed is for the latest commit to the repository, then the following commands are to be executed: git commit --amend -m "New message" git push --force repository-name branch-name.
As listed here (gitlab issue #2551) the wish for such a feature is still present (4 weeks ago).
To answer your question, no, there is none built-in gitlab feature to change the merge message template.
GitLab 14.5 (November 2021) should implement that feature:
Merge commit message template
Merge commits can provide important context to the commit history of a project about what was merged.
However, if you don’t edit the merge commit prior to merging, other users are forced to navigate to a merge request to gain additional context about why the changes were made.Project maintainers can now configure a default merge commit message template.
This allows projects to specify a standard merge commit, and use variables to provide additional details in these messages.
This additional context helps the next developer when trying to understand why the change was made, by providing the potential to make all the relevant information available in the merge commit.Thanks to Piotr for this amazing contribution!
See Documentation and Issue.
With GitLab 14.6 (December 2021), you even have:
Squash commit message template
Squashing commits is a great way to clean up the commit history of a merge request by combining all commits when merging. Branch history becomes easier to read and follow, while the story behind the changes remains intact. GitLab previously used the merge request title as the default squash commit message. If you didn’t edit the message before merging, important details about the change could be lost.
Project maintainers can now customize the default squash commit message according to the project needs. Include details about each merge request, like the source and target branches, with helpful variables. With more complete squash commit messages, everyone can now better understand the context of the changes.
Thanks to Piotr for this amazing contribution!
See Documentation and Issue.
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