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

Đang mở
#875 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
git, ruby
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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 🙂

Ngôn ngữ chính
Ruby
Star
4k
Fork
288
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sds/overcommit

Tất cả issue của sds/overcommit

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.