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! 🎉

Image of Quadratic

Python + AI + Spreadsheet

Chat with your data and get insights in seconds with the all-in-one spreadsheet that connects to your data, supports code natively, and has built-in AI.

Try Quadratic free

Top comments (0)

Jetbrains Survey

Take part in the Developer Ecosystem Survey!

Share your thoughts and get the chance to win a MacBook Pro, an iPhone 16 Pro, or other exciting prizes. Help shape the coding landscape and earn rewards for your contributions!

Take the survey

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️