Skip to main content

A command-line tool that intelligently generates commit messages based on staged file changes in Git using OpenAI's GPT.

Project description

gpt-commit 🚀

gpt-commit is a command-line tool that intelligently generates commit messages based on staged file changes in Git. It utilizes OpenAI's GPT model to craft concise and descriptive commit messages.

License: MIT

Acknowledgements 🙌

This project was inspired by and owes gratitude to the original work found at markuswt/gpt-commit. Thank you for laying the foundation!

Prerequisites 📋

  • Python
  • A valid OpenAI API key

Installation 🛠️

  1. Clone the repository:

    git clone https://github.com/josenerydev/gpt-commit.git
    
  2. Navigate to the project directory:

    cd gpt-commit/
    
  3. Install the package:

    pip install .
    

    For developers: If you're making changes and want to reflect them immediately, install in editable mode:

    pip install -e .
    

Update ⬆️

To upgrade the tool to the latest version:

pip install --upgrade .

Uninstallation ❌

To uninstall the tool:

pip uninstall gpt-commit

Configuration ⚙️

Before using the tool, you need to set up your OpenAI API key.

On Windows (PowerShell):

Before running any PowerShell script, you may need to modify the execution policy. To do this, open PowerShell as an administrator and run:

Set-ExecutionPolicy RemoteSigned

Then, run the setupEnvironmentVariables.ps1 script:

.\setupEnvironmentVariables.ps1 -openaiKey YOUR_OPENAI_API_KEY

On Linux/Mac:

Run the setupEnvironmentVariables.sh script:

./setupEnvironmentVariables.sh YOUR_OPENAI_API_KEY

Remember to replace YOUR_OPENAI_API_KEY with your actual API key.

Usage 🚀

After installation, you can use the gpt-commit tool anywhere in your system:

gpt-commit

Running the above command will analyze changes in staged files in Git and generate a commit message. This message will then be opened in Git's default editor for review or editing. After reviewing the message, save and close the editor to finalize the commit.

For help on available options:

gpt-commit --help

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpt-commit-0.1.2.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

gpt_commit-0.1.2-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page