Let jit create better PR descriptions for you!
jit integrates with the GitHub CLI and leverages local large language models to generate meaningful PR descriptions based on your commits and diffs.
Introduction
The goal of jit is to use the power of LLM's to streamline the development process. Specifically the process of writing pull request descriptions. jit takes it one step further and creates the pull request for you.
You can view the source code here: https://github.com/gsvh/jit
And the project on PyPI here: https://pypi.org/project/jit-cli/
How does it work?
Here is a brief overview of what happens behind the scenes when you run jit push
:
jit uses GitPython to retrieve commit messages and diff data.
jit uses Ollama with llama3 to summarise each diff and generate a pull request description based on the diff summaries and commit messages.
jit will then push your code using git and create a pull request using GitHub CLI
By default jit will create your pull request in draft mode so you can review it before you make it live. Alternatively, you can use the --skip-draft
flag if you want your pull request to go live right away.
Why Ollama?
We love open source. We don't love API costs. We also don't enjoy managing API keys. jit uses Ollama to run llama3 locally. Since all of the commit and diff processing happens on your local machine, you don't have to worry about your code being stored in some database and possibly being used to train other LLM models.
Getting started
Prerequisites
jit uses GitHub CLI to interact with your remote repository and make pull requests.
You can download GitHub CLI from https://cli.github.com/ or install it via Homebrew:
brew install gh
Once installed, log in using:
gh auth login
Installation
Install jit by running:
pip install jit-cli
After installing jit, you can view the welcome screen by running:
jit welcome
Before you can use jit, you first need to download the LLM model (currently llama3) with:
jit pull-model
Usage
Once you have committed all of your work and you are ready to push your work to GitHub, instead of doing:
git push origin <your-branch>
You can do:
jit push
jit will then:
analyse your commit messages and diffs
check if your project uses a pull request template
generate a pull request description
push your current branch to GitHub
create a pull request for you using the generated description
A simple demo
In closing
Developing jit has been an extremely rewarding process. I have been using it almost every day, and it has made such a big difference in my day-to-day as a developer. There is nothing like working really hard on a feature or a bug fix and using one command to create a pull request. It is incredibly satisfying to see jit create beautiful pull request descriptions that are often more detailed than what I would have settled for if I had to write it myself!
I hope that other developers will find this tool useful, and enjoy using it as much as I do.
Can I contribute?
Yes! I thought you'd never ask ;)
jit is an open source tool. For more information on how you can contribute, have a look at the CONTRIBUTING.md file
Subscribe to my newsletter
Read articles from George Sebastiaan van Heerden directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by