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.
- Prefix your branch with the ticket number like ABC-123-best-feature-ever.
git 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
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.