commit-prettier
is an innovative tool that enhances your commit messages by appending an emoji related to the type of commit you make. It seamlessly integrates with commitlint
, supporting all standard commit types including:
Type | Emoji |
---|---|
build | 🏗️ |
chore | 🧹 |
ci | 👷 |
docs | 📄 |
feat | ✨ |
fix | 🐞 |
perf | ⚡️ |
refactor | ♻️ |
revert | ⏪️ |
style | 🌈 |
test | 🧪 |
- Emoji Prefixes: Automatically adds an emoji as a prefix to your commit messages after they pass commitlint checks, making your commit history more expressive and easier to navigate.
- Commitlint Compatibility: Fully compatible with all commitlint types, ensuring your commit messages are both fun and professional.
- Easy Integration: Works with existing git hooks and can be integrated smoothly into your workflow.
Using npm:
npm install --save-dev commit-prettier
or if you prefer using Yarn:
yarn add --dev commit-prettier
To integrate commit-prettier
with Husky (version >= 8.0.0), follow these steps:
- First, ensure you have Husky installed. If not, please follow the instructions.
- Create a
commit-msg
file in the.husky
directory with the following content:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run commit-prettier $1
NOTE: Make sure to make the script executable by running:
chmod +x .husky/commit-msg
Once everything is set up, you can start committing with:
git commit -m "feat(homepage): achieve UI revamp 2.0"
This will trigger the commit message hook, and after passing the commitlint check, commit-prettier will automatically prepend an appropriate emoji, resulting in:
✨ feat(homepage): achieve UI revamp 2.0