Skip to content
πŸ› οΈToolsShed

Git Commit Message Generator

Generate Conventional Commits format messages with type, scope, and description.

About this tool

The Git Commit Message Generator helps developers write clear, standardized commit messages following the Conventional Commits specification. This format makes version control logs readable, enables automated versioning and changelog generation, and improves team collaboration by ensuring consistent message structure across projects. Whether you're working solo or in a large team, properly formatted commits are essential for maintainability and traceability.

To use the tool, select a commit type (feat, fix, docs, style, refactor, test, chore, or perf), optionally add a scope to clarify what part of the codebase changed, write a concise description of the change, and optionally include a body with more details or footer information such as issue references. The tool instantly generates a properly formatted Conventional Commit message that you can copy and paste directly into your version control system.

Developers, DevOps engineers, and open-source maintainers benefit most from adopting Conventional Commits, as they enable semantic versioning automation and professional changelog generation. While some projects may prefer custom commit styles, the Conventional Commits format is widely supported by CI/CD tools, GitHub Actions, and semantic release platforms, making it ideal for modern software workflows.

Frequently Asked Questions

Code Implementation

# Generate Conventional Commit messages programmatically
# No external library needed β€” plain string formatting

from dataclasses import dataclass, field
from typing import Optional

@dataclass
class CommitMessage:
    type: str                          # feat | fix | docs | style | refactor | test | chore ...
    description: str
    scope: Optional[str] = None
    body: Optional[str] = None
    breaking_change: Optional[str] = None
    footer: list[str] = field(default_factory=list)

    def render(self) -> str:
        # Header: type(scope)!: description
        scope_str = f"({self.scope})" if self.scope else ""
        bang      = "!" if self.breaking_change else ""
        header    = f"{self.type}{scope_str}{bang}: {self.description}"

        parts = [header]
        if self.body:
            parts.append("")
            parts.append(self.body)

        trailers = list(self.footer)
        if self.breaking_change:
            trailers.append(f"BREAKING CHANGE: {self.breaking_change}")
        if trailers:
            parts.append("")
            parts.extend(trailers)

        return "\n".join(parts)


# Example usage
msg = CommitMessage(
    type="feat",
    scope="auth",
    description="add OAuth2 login support",
    body="Implements Google and GitHub OAuth2 providers.\nUpdates the session schema.",
    breaking_change="remove legacy /login endpoint",
    footer=["Reviewed-by: Alice <alice@example.com>"],
)
print(msg.render())
# feat(auth)!: add OAuth2 login support
#
# Implements Google and GitHub OAuth2 providers.
# Updates the session schema.
#
# Reviewed-by: Alice <alice@example.com>
# BREAKING CHANGE: remove legacy /login endpoint

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.