To install globally, copy prepare-commit-msg
to /usr/local/share/git-core/templates/hooks
and execute:
chmod +x /usr/local/share/git-core/templates/hooks/prepare-commit-msg
To install per-repository, copy prepare-commit-msg
to /path/to/repo/.git/hooks/prepare-commit-msg
and mark it as executable.
The branch name will be automatically appended to commit messages using git commit
or git commit -m "message"
.
To include a branch description in your desired branch, execute:
git branch --edit-description
This will open your editor, type a description, save, and exit.
If you'd like to use this commit message hook in an existing repository, after copying the file to the proper location, run git init
within the repository for the hook to be initialized.