LLM‑Powered Sidekick for Painless PR Descriptions
Description and use
A Python script uses git diff and commit messages to generate context‑rich PR descriptions via GPT‑3.5‑Turbo‑0125, saving developer effort.
Problem
Writing meaningful pull request descriptions after pushing code is tedious and often results in vague, context‑poor summaries.
Outcome
The script produces structured, context‑rich PR descriptions that save developers time and improve clarity.
Workflow
- 1. Capture git diff via
git diff main...HEADusing a Python subprocess. - 2. Retrieve commit messages with
git log main...HEAD --pretty=format:%s%n%b. - 3. Combine commit messages and diff into a prompt for an LLM (gpt‑3.5‑turbo‑0125).
- 4. Ask the LLM to generate a title, summary, problem, solution, and changes sections.
- 5. Output the formatted description to clipboard or console.
- 6. Optionally integrate into editor or pre‑commit hook.
Evidence
I was using Python 3.10 for this little script, just because that's what my pyenv default was set to.
For the LLM, I picked gpt-3.5-turbo-0125 for its speed and cost-effectiveness for initial experiments.
I added a section for Commit Messages and Git Diff and tweaked the prompt instruction: Analyze the following commit messages and git diff. Based on this information, generate a detailed and context-aware pull request description.
- Record date: 2026-11-02T16:28:57.164Z