vivaxy / vscode-conventional-commits

💬Conventional Commits for VSCode.
https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits
MIT License
309 stars 32 forks source link

[FEAT] Auto add the branch name to commit message #301

Open JackWP1 opened 1 year ago

JackWP1 commented 1 year ago

Is your feature request related to a problem? Please describe

Nope. Just another nice-to-have on already great bit of software.

Describe the solution you'd like

If there was someway of adding part or all of the branch name to the commit message automatically. Maybe there would be some regex involved of the user to customise the end result. e.g. Branch name: ABC-1234-some-great-feature Commit message input pre-filled: ABC-1234 -

Additional context

Screenshot 2023-01-03 at 5 02 26 pm

vivaxy commented 1 year ago

@JackWP1 Thanks for your suggestion.

  1. Is there any other products that implements this feature?
  2. Why is the branch name associated with the commit message?
kiero-pl commented 1 year ago

I see no activity and I also would like to see this kind of feature in this plugin so I will try to answer at least the second question.

In my company, we have an additional policy for conventional commits. Every commit should have a task ID from Jira, eg. : "feat: RSPT-123 add new component". And we have a policy for branch naming. As you probably guess we need to have a task ID in the branch name (or "NOID" if this is a simple ad-hoc).

If this is any help we got this regex for a commitlint

"task-id-rule": ({ subject }) => {
        const regExp = /[A-Z]+-\d+|NOID/;
        return [regExp.test(subject), "subject must contain task id (eg RSPT-123) or NOID"];
},
MMMikeM commented 9 months ago

Also need this. @vivaxy are you open to a PR for this feature?