omarshaarawi / commitgpt

Automatically generate commit messages using ChatGPT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

commitgpt

Automatically generate commit messages using ChatGPT.

commitgpt

How to use?

npx commitgpt

or use -c for conventional commits format.

npx commitgpt -c

On the first run you will be asked to enter your OpenAI session token.

Get your session token

  1. Go to https://chat.openai.com/chat and log in or sign up.
  2. Open console with F12.
  3. Open Application > Cookies. image
  4. Copy the value for __Secure-next-auth.session-token and paste it into config.json.example under session_token. You do not need to fill out Authorization image
  5. Save the modified file to config.json (In the current working directory)

How it works

  • Runs git diff --staged
  • Sends the diff to ChatGPT and asks it to suggest commit messages
  • Shows suggestions to the user

Credits

Some code and approaches were inspired by the awesome projects below:


Do you need API docs? Check out Redocly.

About

Automatically generate commit messages using ChatGPT


Languages

Language:TypeScript 56.5%Language:JavaScript 43.5%