[Feature suggestion] Extend commit-msg with auto jira ticket number prefix

Aperta
#875 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
git, ruby
Ambito
tooling

Direzione di ricerca

The request is a new commit-msg hook that reads a Jira-style ticket ID from the branch name and prepends it to the commit message, skipping it if already present. Start by finding how the repository already defines and runs commit-msg hooks, and how it reads the current branch name. Done means a commit on a branch like task/XXX-1234/fix-bug gets [XXX-1234] prepended, with no duplicate, and that behaviour is covered by a test. The open questions are the ID pattern and whether it should be configurable, so confirm those with a maintainer before writing code.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi there!

Many large teams use project management tools such as Jira/Trello/etc., along with standardized branch and commit naming conventions.
For example most common branch naming pattern looks like:

  • $type/$PRJ-$NNN/$ticket_description
    Where:
  • $type – ticket type (e.g., task, bug, hotfix, typo)
  • $PRJ-$NNN – ticket identifier (e.g., PROJ-1234)
  • $ticket_description – short description

Example branch names:

  • task/XXX-8765/change_registration_form
  • bug/XXX-9012/fix_reimport_worker
  • typo/XXX-1234/fix_notification_message_wording
  • hotfix/XXX-5678/fix_latest_data_migration

Similarly, commit messages often follow a required format:

  • [$PRJ-$NNN] Short commit description

It can be automated via a commit-msg git hook.So, if the branch name contains a ticket identifier (e.g., task/XXX-1234/fix-bug), the hook can automatically prepend [XXX-1234] to the commit message unless it's already present.

I've already implemented this behavior in my gem:

If you think this would be useful here, I'd be happy to open a PR adding similar functionality to overcommit.

Looking forward to your thoughts 🙂

Lingua principale
Ruby
Stelle
4k
Fork
288
Merge medio
2g 4h
PR unite (30g)
18

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sds/overcommit

Tutte le issue di sds/overcommit

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.