cmtmsg - AI-powered git commit message generator
cmtmsg [--confirm] [--upstream-name=NAME]
cmtmsg generates conventional commit messages using OpenAI's API based on your git working tree changes. It analyzes the diff and creates properly formatted commit messages following the Conventional Commits specification.
The script requires a .env
file in the same directory containing your OpenAI API key as OPEN_AI_KEY
.
--confirm : Skip confirmation prompts and automatically commit and push changes
--upstream-name=NAME : Specify the upstream remote name (default: origin)
--upstream-name NAME : Alternative syntax for specifying upstream remote name
.env
: Configuration file containing OPEN_AI_KEY
and optional MODEL
variables
OPEN_AI_KEY : OpenAI API key (loaded from .env file)
MODEL : OpenAI model to use (default: gpt-4o, loaded from .env file)
Generate commit message with prompts:
cmtmsg
Auto-commit and push to origin:
cmtmsg --confirm
Use custom upstream remote:
cmtmsg --upstream-name=upstream
Auto-commit with custom remote:
cmtmsg --confirm --upstream-name=fork
0 - Success or no changes detected
1 - Error (missing .env, API failure, invalid arguments)
Generated commit messages follow the Conventional Commits format with type, scope, and description.