DEV Community

Shyam Tala
Shyam Tala

Posted on β€’ Edited on

2

πŸš€ Introducing Git Styler: Make Your Git Commits Cleaner and Faster!

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
Enter fullscreen mode Exit fullscreen mode

⚠️ 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
Enter fullscreen mode Exit fullscreen mode

Simply run:

gfeat "Added a new authentication module"
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή This automatically formats the commit as:

git commit -m "πŸ“¦ NEW: Added a new authentication module"
Enter fullscreen mode Exit fullscreen mode

2️⃣ Releasing a New Version

grel "Version 1.0.0 release"
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ This runs:

git commit -m "πŸ¦„ RELEASE: Version 1.0.0 release" && git push
Enter fullscreen mode Exit fullscreen mode

πŸ” Debugging & Help

If you run into any issues, check available commands with:

git-styler --help
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ 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
Enter fullscreen mode Exit fullscreen mode

Let me know what you think in the comments! Happy coding! πŸŽ‰

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay