Tired of messy commit messages? Keeping a clean Git history is crucial for collaboration, but writing well-structured commit messages every time can be a hassle. Enter Git Styler β a CLI tool that simplifies commit message styling and enforces structure effortlessly. π
Why Git Styler? π€
Writing commit messages manually can lead to inconsistencies like:
- Unclear or unformatted commit messages
- Inconsistent use of emojis or prefixes
- No standard format for different types of commits
Git Styler solves this by providing easy-to-use commands for well-structured commits, following conventional commit formats.
π Features
β
Predefined commit types with appropriate emojis π¦ π β»οΈ π
β
Shortcut commands for quick commits (e.g., gfeat
, gfix
, grel
, etc.)
β
Automatic git push
after committing changes
β
Color-coded logs for better visibility
β
No extra configuration needed β works out of the box!
π Installation
Git Styler should be installed globally so that commands are available system-wide.
npm install -g git-styler
β οΈ Avoid local installation (npm install git-styler
), as the commands won't be recognized outside the project.
π How It Works
Git Styler introduces easy-to-remember commands for different commit types. Here are some examples:
Command | Emoji | Type |
---|---|---|
gfeat |
π¦ | NEW (Feature) |
gimp |
π | IMPROVE (Enhancement) |
gfix |
π | FIX (Bug Fix) |
gdoc |
π | DOC (Documentation) |
gtest |
π€ | TEST (Testing) |
gbreak |
βΌοΈ | BREAKING (Breaking Change) |
grel |
π¦ | RELEASE (Release) |
gref |
β»οΈ | REFACTOR (Refactor Code) |
β¨ Usage Examples
1οΈβ£ Standard Commit
Instead of writing:
git add . && git commit -m "Added a new authentication module" && git push
Simply run:
gfeat "Added a new authentication module"
πΉ This automatically formats the commit as:
git commit -m "π¦ NEW: Added a new authentication module"
2οΈβ£ Releasing a New Version
grel "Version 1.0.0 release"
π This runs:
git commit -m "π¦ RELEASE: Version 1.0.0 release" && git push
π Debugging & Help
If you run into any issues, check available commands with:
git-styler --help
π οΈ How Git Styler Works Under the Hood
Git Styler is built using:
- Commander.js β For handling CLI commands
- child_process β To execute Git commands
- path module β For script detection
The tool intercepts Git commands and ensures they follow a structured format before committing. No extra configuration is needed! π
π’ Spread the Word!
If you find Git Styler useful, please star the GitHub repo and share it with your team! β
GitHub Repo
π Start making your commit history cleaner today!
npm install -g git-styler
Let me know what you think in the comments! Happy coding! π
Top comments (0)