GithubHelp home page GithubHelp logo

lightningorb / autocommit Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 2 KB

This python utility automatically generates git commit messages using GPT3.5

Python 100.00%
automation commit devtools git llm message openai workflow

autocommit's Introduction

Autocommit: A Python Module for Generating High-Level Git Commit Messages

About

Autocommit is a Python module that leverages the power of GPT-3.5-turbo model from OpenAI to generate sophisticated, high-level git commit messages based on the changes you make in your codebase.

Instead of focusing on granular details or specific files/functions/classes, this module creates commit descriptions that encapsulate the broader impact of your changes from a user's perspective. This means clearer, more understandable commit history and less time spent crafting commit messages!

For example, instead of writing "Refactored function x in File y", autocommit will generate something like "Improved site performance".

How It Works

The script reads the diff output for staged changes and generates a commit message that reflects the high-level effects of those changes.

These commit messages aim to be succinct (maximum 30 words), written in modern British English, and avoid sounding robotic. The tool avoids starting sentences with connective words like "Also", "Finally" etc.

Installation

git clone https://github.com/lightningorb/autocommit.git
cd autocommit
pip3 install .
hash -r

Usage

Once you've staged your git changes, run the Python script:

autocommit

Autocommit will output a suggested commit message and ask for your confirmation ("OK y/n: "). If you're happy with the suggestion, simply type y and press enter. The script will then make the git commit using the generated message.

If you aren't satisfied with the suggested commit message, enter n and run the script again for a new suggestion.

Example Commit Messages

Here are some examples of the type of commit messages generated by this module:

  1. "Updated site."
  2. "Xcode 14.3.1 IOS launch issues"
  3. "Fixed a crash when restarting from Connector. Resolved HTLCs animations typing issue, and missing field. Balanced ratio line is now easier to see."
  4. "Move all apps into the 'apps' dropdown, and disable app store #10"
  5. "Don't unmount after install (reduce risk of failure)"

Go ahead and try it out for yourself!

Environment Variables

You must set your OpenAI API key as an environment variable OPEN_API_KEY to allow the script to access the GPT-3.5-turbo model.

Dependencies

  • Python 3.x
  • An active OpenAI account and API key

Todo

  • use tiktoken for token calculation, to not go over the maximum token limit.

autocommit's People

Contributors

lightningorb avatar

Stargazers

Koo avatar Damm Bro  avatar @RandyMcMillan avatar  avatar

Watchers

Kostas Georgiou avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.