Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (opencommit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

All the commits in this repo are done with OpenCommit — look into the commits to see how OpenCommit works. Emoji and long commit description text is configurable.
Setup
Install OpenCommit globally to use in any repository:
npm install -g opencommit
Get your API key from OpenAI. Make sure you add payment details, so API works.
Set the key to OpenCommit config:
opencommit config set OPENAI_API_KEY=<your_api_key>
Your api key is stored locally in
~/.opencommit
config file.
Usage
You can call OpenCommit directly to generate a commit message for your staged changes:
git add <files...>
opencommit
You can also use the oc
shortcut:
git add <files...>
oc
Features
Switch to GPT-4
By default OpenCommit uses GPT-3.5-turbo (ChatGPT).
You may switch to GPT-4 which performs better, but costs ~x15 times more 🤠
oc config set model=gpt-4
Make sure you do lowercase gpt-4
.
Preface commits with emoji 🤠
GitMoji convention is used.
To add emoji:
oc config set emoji=true
To remove emoji:
oc config set emoji=false
Postface commits with descriptions of changes
To add descriptions:
oc config set description=true
To remove description:
oc config set description=false
Configure openAI maxTokens param
Default value for maxTokens
is 196, sometimes you can get 400 error if request+response exceeds maxToken
parameter.
so you can increase it:
oc config set OPENAI_MAX_TOKENS=<number>
Configure BASE_PATH for openAI api
if you want to call GPT via proxy — you can change BASE_PATH
parameter:
oc config set OPENAI_BASE_PATH=<string>
Internationalization support
To specify the language used to generate commit messages:
# de, German ,Deutsch
oc config set language=de
oc config set language=German
oc config set language=Deutsch
# fr, French, française
oc config set language=fr
oc config set language=French
oc config set language=française
The default language set is English
All available languages are currently listed in the i18n folder
Git flags
The opencommit
or oc
commands can be used in place of the git commit -m "${generatedMessage}"
command. This means that any regular flags that are used with the git commit
command will also be applied when using opencommit
or oc
.
oc --no-verify
is translated to :
git commit -m "${generatedMessage}" --no-verify
Ignore files
You can ignore files from submission to OpenAI by creating a .opencommitignore
file. For example:
path/to/large-asset.zip
**/*.jpg
This is useful for preventing opencommit from uploading artifacts and large files.
By default, opencommit ignores files matching: *-lock.*
and *.lock
Git hook
You can set OpenCommit as Git prepare-commit-msg
hook. Hook integrates with you IDE Source Control and allows you edit the message before commit.
To set the hook:
oc hook set
To unset the hook:
oc hook unset
To use the hook:
git add <files...>
git commit
Or follow the process of your IDE Source Control feature, when it calls git commit
command — OpenCommit will integrate into the flow.
Payments
You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT (3.5-turbo) official model, that is ~15x times cheaper than GPT-4.