diff-summarizer
is a command-line tool that leverages advanced AI models like OpenAI's GPT-4 and Anthropic's Claude to automatically generate clear and concise Git commit messages based on your staged changes. By analyzing the differences in your code, it creates commit messages that adhere to best practices and formatting guidelines, saving you time and ensuring consistency across your project's commit history.
diff-summarizer
fetches the diff of your staged changes using git diff --cached
and sends this information to the AI model. The AI then generates a commit message following Git best practices, which is printed to the console and copied to your clipboard for easy pasting.
# Clone the repository
git clone https://github.com/vancura/diff-summarizer.
# Stage your changes
git add .
# Generate commit message with Claude 3.5
npm start
# Generate commit message with GPT-4
node diff-summarizer-gpt4o.mjs
# Using environment variables
export OPENAI_API_KEY_DIFF_SUMMARIZER="your-openai-api-key"
export CLAUDE_API_KEY_DIFF_SUMMARIZER="your-claude-api-key"
Licensed under the MIT License. See the LICENSE file for details.