prefix-commit-msg
v0.0.1
Published
A Git hook to automatically prefix commit messages with issue numbers from branch names.
Readme
Prefix Commit Message Git Hook
prefix-commit-msg is a Git hook helper designed to automatically prefix your commit messages with issue numbers extracted from your current Git branch name (e.g., feat/TICKET-123-add-feature becomes TICKET-123 | Your commit message).
⚠️ Active Development
This tool is currently under active development. Features and usage may change.
Purpose
This script is intended to be used as a prepare-commit-msg Git hook. It helps ensure that commit messages are consistently associated with a ticket or issue number, improving traceability in project management systems.
Basic Setup (for local development/testing)
Build the project:
npm run buildLink for local use: To test the CLI locally as if it were installed globally:
npm linkYou can then run
prefix-commit-msgin your terminal (ensure you are in a Git repository for it to function as intended with commit messages).Git Hook Integration (Manual Example): To use it as a
prepare-commit-msghook in a repository, you would typically create a script in.git/hooks/prepare-commit-msgthat calls this CLI tool:#!/bin/sh # .git/hooks/prepare-commit-msg # Example: if you linked prefix-commit-msg globally prefix-commit-msg "$1" # Or, if installed as a project dependency (once published): # npx prefix-commit-msg "$1"Make sure the hook script is executable (
chmod +x .git/hooks/prepare-commit-msg).
Further instructions on packaging and distribution will be added as development progresses.
