DEV Community

Cover image for Supercharge Your Git Workflow with Laravel Commit‑Lint
Mubbasher Ahmed Qureshi
Mubbasher Ahmed Qureshi

Posted on

Supercharge Your Git Workflow with Laravel Commit‑Lint

Tired of messy, inconsistent commit messages cluttering your Git history?

Say hello to Laravel Commit‑Lint — a lightweight, developer-friendly Laravel package built to enforce Conventional Commits right from your terminal.

Crafted by Mubbasher Ahmed Qureshi (@mubbi), this tool brings structure, readability, and automation to your Git commits—without any complex setup or bloated dependencies.


🧠 Why Commit Linting Even Matters

Before diving into features, let’s answer a critical question:

“Isn’t this just extra work?”

Actually, it’s the opposite.

Standardizing commit messages makes your Git history predictable, changelogs automated, and team collaboration smoother. It also plays perfectly with tools like semantic versioning and CI/CD pipelines.

And Laravel Commit‑Lint brings all of this goodness—natively—to your Laravel workflow.


📦 What Is Laravel Commit‑Lint?

Laravel Commit‑Lint is a plug-and-play package that installs a commit-msg Git hook in your Laravel project. Every time you commit, it validates your message against the Conventional Commits format:

<type>(<scope>): <short description>
Enter fullscreen mode Exit fullscreen mode

No valid format? The commit is blocked—with helpful feedback to fix it.

feat(auth): add login endpoint

updated stuff

And don’t worry—special commits like merge, WIP, or revert are automatically skipped.


⚙️ Key Features

  • 🔍 Real-time commit validation – Catch bad messages before they hit your repo.
  • Zero-config Artisan install – Just run php artisan commitlint:install.
  • 🚫 Smart skipping – Merge, WIP, and revert commits are ignored.
  • 🛠 Customizable hooks – Install to a custom path or use your own stub.

🚀 Getting Started

1. Install the Package

composer require mubbi/laravel-commit-lint --dev
Enter fullscreen mode Exit fullscreen mode

2. Install the Git Hook

php artisan commitlint:install
Enter fullscreen mode Exit fullscreen mode

That’s it. You’re live.

Want a custom hook path?

php artisan commitlint:install /your/custom/path
Enter fullscreen mode Exit fullscreen mode

Or maybe a custom hook script?

php artisan commitlint:install --stub=/path/to/your/hook.stub
Enter fullscreen mode Exit fullscreen mode

🧪 Try It in Action

git commit -m "fix(user): handle null emails"
# ✅ Success

git commit -m "fixed stuff"
# ❌ Rejected – helpful message shown
Enter fullscreen mode Exit fullscreen mode
git commit -m "WIP: experimenting with Stripe"
# ✅ Skipped – WIP commit allowed
Enter fullscreen mode Exit fullscreen mode

💡 Real-World Use Case: Why This Exists

While contributing to the Laravel core, I proposed PR #56443 to introduce commit linting as a built-in feature. The Laravel team appreciated the idea, but Taylor Otwell preferred keeping the core minimal—so I released it as a standalone tool.

Now, Laravel devs can still enjoy structured commit messages—without touching the framework itself.


🧰 Valid vs Invalid Commit Messages

✅ Valid Examples

  • feat: add user registration
  • fix: correct timezone offset
  • chore: clean up config files
  • docs(readme): update usage guide

❌ Invalid Examples

  • fixed auth
  • update stuff
  • bug fix
  • done

When a message is invalid, you’ll see a helpful explanation and suggested fixes—so you can commit confidently.


🧯 Troubleshooting & Tips

  • 🔐 Permission issues? Run:

    chmod +x .git/hooks/commit-msg

  • 📂 Custom path errors? Ensure the directory exists and is writable.

  • 🌀 Artisan command not found?

    Run composer dump-autoload.

  • 🧪 Need flexibility? Customize the hook stub and format to match your team’s standards.

  • Want to remove it?

    Delete the hook file or run:

  composer remove mubbi/laravel-commit-lint
Enter fullscreen mode Exit fullscreen mode

🧭 Final Thoughts

Laravel Commit‑Lint is a no-nonsense tool for teams who value:

  • ✅ Clean, consistent Git logs
  • ✅ Seamless automation (semantic versioning, changelogs, CI)
  • ✅ Laravel-native tooling—no Node or external dependencies

It’s especially perfect for Laravel 12+ teams that want structure without sacrificing speed.


🔗 Ready to Try?

Add it to your project today:

composer require mubbi/laravel-commit-lint --dev
php artisan commitlint:install
Enter fullscreen mode Exit fullscreen mode

Visit the repo: github.com/mubbi/laravel-commit-lint

Top comments (0)