Git Hook to insert branch name to commit message.
When you commit to Git, hook automatically replaces "[branch]" with name of current branch.
Suppose you are working on branch "555-fix":
[branch] Fixed a typo
You commit this, and see in Git log:
555-fix Fixed a typo
To use this hook, you need
Windows (not tested on Linux)
NodeJS
Git
Clone this repo.
Instal Node.js dependecies with
npm install
Copy hook to target project directory.
copy C:\path-to-git-hook\commit-msg.sample C:\path-to-target-project\.git\hooks\commit-msg
Edit file commit-msg
-- change path to git-hook folder.
Make this file executable
attrib +x commit-msg
Copy commit-template.sample
file to commit-template
.
Edit commit-template
as you like.
Plug in the template:
Change directory to target project folder.
Run
git config commit.template C:\path-to-git-hook\commit-template
You will get this template when create new commit with SmartGit.
- MIT license
- Copyright 2020 © Nex Otaku.