'How can I configure the default MR title & message via push options in GitLab?
GitLab has a long-standing issue to make MR titles & messages configurable; see Ability to customise default merge request title (#16080).
Unfortunately the change Set default MR title/description to first multi-line commit (!52984) has made the default title & message even more frustrating for many users. Unless you are really thinking hard about your first multiple-line commit, given you even know how this works, you can get some really bizarre defaults for your MR title & message. Users could write a git commit --allow-empty message early in their history, but we aren't always creating MRs for history we can still edit. In many cases you may not even want a complicated title & message, if you believe the code is a better place to put documentation (e.g. in a new commit at the end of history).
Is there a simple way to set up an alias or git alias to make this configurable via a push option? See Push Options | GitLab for the exposed settings.
I've been using this long alias in my global git config file. The non-empty merge_request.description is necessary because if you only set the MR title the MR message still gets the message from the first multi-line commit ☹.
pm = "!f() { git push -o merge_request.create -o merge_request.description=x -o merge_request.title=${2} ${1} ${2}; }; f"
That is, rather than git push remote branch-name I run git pm remote branch-name. Unfortunately auto-complete doesn't work with this kind of alias. Am I missing some simpler way to achieve this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
