Effortless Git Integration with GPT-Powered Commit Assistance
This tool is designed to automate several common Git operations, enhancing the standard Git workflow with additional features. It helps in managing unpushed commits, checking for local changes, generating commit messages using OpenAI's GPT-4 API, editing commit messages, and handling the push operation to a remote repository.
Watch.GPIT.in.action.mov
- π Check for Unpushed Commits: Quickly identify any commits that haven't been pushed to the remote repository.
- π Detect Local Changes: View a summary of local changes that are not yet committed.
- π¬ Generate Commit Messages: Utilizes GPT-4 to suggest commit messages based on the detected changes.
- βοΈ Edit Commit Messages: Offers an interactive editor for customizing commit messages.
- π Stage, Commit, and Push: Automates the process of staging changes, committing them with a chosen message, and pushing to the remote repository.
GPIT can be installed directly from PyPI:
pip install gpit
This tool requires Python 3.x. Make sure you have Python installed on your system.
Before using the tool, make sure to set your OpenAI API key as an environment variable:
export OPENAI_API_KEY='your_openai_api_key'
Alternatively, you can set it in a .env
file in the same directory as the script.
The most recommended way to save the key is through "Shell Profile Files":
Open or create the .bashrc file:
nano ~/.bashrc
Add your export statement:
export OPENAI_API_KEY="your_openai_api_key_here"
Save and exit. Apply the changes:
source ~/.bashrc
Verifying the Variable:
echo $OPENAI_API_KEY
Once installed, you can run GPIT from any Git repository on your system. Simply use the following command:
gpit
Follow the on-screen prompts to manage your Git operations.
- Git
- Python 3.x
- Requests library for Python
- python-dotenv (for managing environment variables)
Install Python dependencies using:
pip install requests python-dotenv
Contributions to this project are welcome! Please fork the repository and submit a pull request with your proposed changes.