Package Exports
- @humankode/git-commit-emojify
- @humankode/git-commit-emojify/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@humankode/git-commit-emojify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
git-commit-emojify
A
commit-msg
git hook script to automatically add emojis to git commit messages
For example, git commit -m "hotfix to fix caching"
//=> 🚑 hotfix to fix caching
or
in branch feature-implement-caching
git commit -m "implemented caching"
(uses branch name to determine which emoji to use if not enough context in the commit message)
//=> ✨ implemented caching
Usage
Install and configure Husky
.husky/commit-msg
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install @humankode/git-commit-emojify
Zero config by default
Zero configuration by default.
If no configuration specified, it will
- map a commit message to an emoji using emojiKeywordMap.ts
- if unable to map a message to an emoji, it will attempt to map the branch name to an emoji using branchTypes.ts
Configuration
Place a file git-commit-emojify.json
in your root directory.
Refer to the Configuration interface for all options.
Example configurations
1. Override branch type configuration
git-commit-emojify.json
{
"branchTypes": {
"build": {
"emoji": "👷"
},
"bugfix": {
"emoji": "🐛"
}
}
}
2. Suffix the emoji
git-commit-emojify.json
{
"prefixEmoji": false
}
This will place the emoji at the end of the commit message.
3. Suffix the emoji
git-commit-emojify.json
{
"emojiKeywords": [
{
"keywords": ['bug'],
"emoji": "🪲",
},
{
keywords: ["revert"],
emoji: "⏪️",
}
]
}
4. Complete configuration example
git-commit-emojify.json
{
"prefixEmoji": true,
"branchTypes": {
"build": {
"emoji": "👷"
},
"bugfix": {
"emoji": "🐛"
}
},
"emojiKeywords": [
{
"keywords": ['bug'],
"emoji": "🪲",
},
{
keywords: ["revert"],
emoji: "⏪️",
}
]
}
This will override the configuration for emojiKeywords
and will match the keywords bug
and revert
to commit messages.