gitsums is a small utility that uses AI to generate summaries and analyze risks for Git changes. It helps developers quickly understand the impact of their commits or branch differences.
- Generate a concise summary of Git changes using OpenAI's GPT models.
- Analyze potential risks or problems in code changes.
- Manage ignored files for analysis.
- Compare changes between branches or recent commits.
- Save and manage OpenAI API keys securely.
- Customize prompts for AI analysis.
npm install -g gitsumsGenerate a summary of changes for the last N commits:
gitsums -c <N>Generate a summary of changes between two branches:
gitsums -b <branch1> <branch2>Analyze potential risks in the changes:
gitsums -c <N> -rUse an additional flag to use custom prompt for AI analysis:
gitsums -c <N> -CSet a custom prompt:
gitsums --set-custom "<your_custom_prompt>"Add a file to the ignore list:
gitsums -ia <file>Remove a file from the ignore list:
gitsums -ir <file>View the ignore list:
gitsums -ilIgnored files are excluded from the diff analysis. You can add or remove files from the ignore list using the commands above or by editing the configuration file directly.
Save your OpenAI API key for authentication:
gitsums -k <api_key>Save your Chat GPT model (default: gpt-4.1-nano):
gitsums -m <model>Alternatively, you can set the API key using the OPENAI_API_KEY environment variable:
export OPENAI_API_KEY=<api_key>Analyze the last 3 commits and summarize the changes:
gitsums -c 3Compare changes between main and feature branches:
gitsums -b main featureAnalyze risks for the last 5 commits:
gitsums -c 5 -rUse a custom prompt to generate release notes:
gitsums -CThe tool provides detailed error messages for common issues, such as:
- Missing OpenAI API key
- Invalid or missing configuration file
- Git command failures Ensure you follow the instructions provided in the error messages to resolve issues.
The tool stores its configuration in a file located at:
~/.git-summary-cli/config.json
This file is automatically created if it does not exist. You can manually edit this file to update settings like the API key, ignored files, or custom prompts.
Additionally, you can use a .gitsumsrc file in your project directory to override global settings. Example .gitsumsrc:
{
"model": "gpt-4.1-mini",
"ignoreFiles": ["yarn.lock", "src/index.cjs"],
"customPrompt": "Generate short and concise release notes based on this git diff"
}- Node.js >= 14
- OpenAI API key
npm installnpm startnpm run lintnpm run testThis project is licensed under the MIT License.
Created by Oleksiy Rabeshko.
Feel free to contribute or open issues on the GitHub repository.