Customize branch name when using create branch in an issue
Resources
PM @victorwu
Description
- Customize branch name when using the create branch button in an issue.
- The default name is shown. You can change it something else.
Out of scope
- Regular expressions or branch groupings are out of scope.
Design
Updated design to work with https://gitlab.com/gitlab-org/gitlab-ce/issues/28558
Previous description
Description
When creating a new branch from the issue page with the "new branch" button, the branch's name is always the issue ID followed by the hyphenated title, and there is no option to change it before the branch is created.
It would be great to introduce the ability to change the branch name before creating it for the following reasons:
- It will help people who use branch name groups (
feat/314-service-loader
orhotfix/154-username-buffer-overflow
)- It will help keep branch names short and to the point (
feat/111-admin-kerberos-authentication
instead of111-add-kerberos-authentication-to-the-log-in-page-of-the-administrators-panel
, which is derived from the title)Proposal
Before I upgraded my GitLab instance from 8.7.5 to 8.10.5 I implemented it by myself (it looked like abomination but it worked). Unfortunately for me, it's now gone because I forgot to back it up.
The proposal is simple - when clicking "new branch", instead of posting branch creation to the server, display a textbox and a submit button.
By default, the textbox contains the original branch name (i.e., issue ID followed by hyphenated title, as it is right now), so the introduced overhead of creating a new branch with the default name is a single click.Some neat improvements to the new branch button could also include:
- Add a setting to the project settings to set the default branch name (e.g., "feat/{issueid}-{hyphenatedtitle}")
- Add a setting to the project settings to enforce new branch names to conform to a specific regular expression (e.g.
(?:feat|bug|hotfix|junk)\/\d+(?:-[a-z0-9]+)+
)Design
Notes:
- This issue will also fix https://gitlab.com/gitlab-org/gitlab-ce/issues/24327
- There can be multiple related branches to one issue (this is already possible) therefore we need to let the button still be available, but in a less obvious way
- So even if a branch is already been created/related another "new branch" is still possible, the example name given now however gets an extra number
-2
- Copying existing related branch names directly from the issue view + making them more visible (along with related merge requests):
location: