Description
Are you still prefixing your commits with a ticket number manually? You will love this script! This is a git hook script that will automatically prefix your commit messages with a ticket based on the branch name.
Usage
- Prefix your branch with the ticket number like ABC-123-best-feature-ever.
- Running
git commit
orgit commit -m ...
whatever you prefer If you use the latter, just enter your commit message without worrying about the ticket numner. Once you submit your commit message this hook will automatically add the prefix for you. - Enjoy the ease of following conventions
Installation:
Either copy this script to: your/awesome/project/.git/hooks/prepare-commit-msg
Or create a global git template that gets copied each time you create or clone a git repository git config --global init.templatedir '~/.git_template/'
Because this is a regular script file, we need to make it executable: chmod +x .git/hooks/prepare-commit-msg
Good catch @larister. I updated the documentation.