DEV Community

Cover image for I built a CLI that writes Git commit messages for you
Aashir Zayd
Aashir Zayd

Posted on

I built a CLI that writes Git commit messages for you

I Built a CLI That Helps Generate Git Commit Messages Automatically

Writing commit messages is one of those small tasks that slows down development more than we expect.

You finish implementing a feature, stage your files, and then pause for a moment thinking:

Should this be a feat or fix?
What scope should I use?
How should I phrase this commit?

To make this process faster, I built a small tool called Smart Commit CLI.


What is Smart Commit CLI?

Smart Commit CLI is an interactive command-line tool that analyzes your staged files and helps generate clean, structured commit messages.

Instead of manually thinking about commit formats, the CLI guides you through the process and suggests the appropriate commit type.

The goal is simple: make Git commit messages faster and more consistent.


Features

Smart Commit provides a few useful features:

  • Commit type suggestions based on staged files
  • Automatic scope detection from folder structure
  • Diff summary preview before committing
  • Interactive CLI prompts for structured commits
  • Quick mode for instant commits

It follows the Conventional Commits format, which keeps Git history clean and readable.

Example commit:

feat(auth): add login validation
Enter fullscreen mode Exit fullscreen mode

Or with emoji:

✨ feat(auth): add login validation
Enter fullscreen mode Exit fullscreen mode

Example Workflow

Typical usage looks like this:

git add .
smart-commit
Enter fullscreen mode Exit fullscreen mode

Then the CLI guides you through the process:

Checking git status...

Staged files:
src/auth/login.js

Changes Summary:
Files: 1 | +20 additions | -3 deletions

Suggested commit type: feat

? Commit type: feat
? Scope: auth
? Commit message: add login validation
Enter fullscreen mode Exit fullscreen mode

Final commit:

✨ feat(auth): add login validation
Enter fullscreen mode Exit fullscreen mode

Installation

You can install it globally with npm:

npm install -g smart-commit-cli
Enter fullscreen mode Exit fullscreen mode

Or run it instantly using npx:

npx smart-commit-cli
Enter fullscreen mode Exit fullscreen mode

GitHub Repository

If you’d like to try it or contribute, the project is open source:

https://github.com/AashirZayd/smart-commit


Why I Built It

This tool started as a small experiment to improve my own workflow.

I often found myself spending unnecessary time writing commit messages or forgetting to follow conventional commit formatting.

Smart Commit automates that process while still keeping developers in control of the final message.


Feedback Welcome

If you’re a developer who values a clean Git history, I’d love to hear your thoughts.

Suggestions, improvements, and contributions are always welcome.

⭐ If you find the project useful, consider giving the repository a star.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.