🚀 Git Commit Message Generator (Reasoning Version)
The Git Commit Message Generator is an AI - powered tool hosted on Hugging Face. It can transform your code diffs into clear and meaningful commit messages with detailed reasoning. This reasoning version not only provides a commit message but also explains the thought process behind it, making your commit history more transparent and informative.
Note: This is the reasoning version of the Git Commit Message Generator. For other versions (e.g., Chain of Draft or standard), check out my Ollama repository for more details.
Beta Status: This version is in beta. Your feedback is essential to refine it further!
🚀 Quick Start
This tool can effectively convert your code diffs into well - reasoned commit messages. You can use it through the web interface or API integration.
✨ Features
- Reasoning Output: Along with the commit message, it provides a detailed breakdown of the changes and the logic behind the message.
- Multiple Interaction Methods: Support for web interface and API integration.
- Command - Line Option: Optional installation of the
git - gen - commit
script for a command - line experience.
📦 Installation
Installing git - gen - commit
(Optional)
For a command - line experience, you can install the git - gen - commit
script, which generates commit messages from your git diff.
Disclaimer: The git - gen - commit
script uses the Ollama API, not the Hugging Face model. Results may differ from this reasoning version. For more details, visit my Ollama repository.
Installation (macOS/Linux)
Run this command to install git - gen - commit
globally:
sudo sh -c 'curl -L https://gist.githubusercontent.com/Tavernari/b88680e71c281cfcdd38f46bdb164fee/raw/git-gen-commit \
-o /usr/local/bin/git-gen-commit && chmod +x /usr/local/bin/git-gen-commit'
💻 Usage Examples
Web Interface
- Go to the Hugging Face Model Page.
- Paste your git diff into the input box.
- Click "Generate" to get the reasoning and commit message.
API Integration
- Use the Hugging Face Inference API to integrate the model into your workflows.
import requests
API_URL = "https://api-inference.huggingface.co/models/Tavernari/git-commit-message"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
diff = """
diff --git a/file1.py b/file1.py
index 83db48f..bf2a9a2 100644
--- a/file1.py
+++ b/file1.py
@@ -1,3 +1,4 @@
def hello():
print("Hello, world!")
+ print("Welcome to AI commit messages!")
"""
output = query({"inputs": diff})
print(output)
- Replace
YOUR_HF_TOKEN
with your Hugging Face API token. The response will include both reasoning and the commit message.
Command - Line Usage
Once the git - gen - commit
script is installed, run:
git gen-commit
This will analyze your current git diff and generate a commit message via the Ollama API.
📚 Documentation
Output Format
The model outputs two main components wrapped in a structured format:
- Reasoning: A detailed breakdown of the changes in your diff and the logic behind the commit message.
- Commit Message: A concise summary of the changes, followed by a more detailed description.
Example Output:
<reasoning>
The diff shows changes in `WalletManagerView.swift`. The most significant changes are the
addition of a new `@State` variable `monthlySpentGoal` and modifications to existing functions
and state variables. The `monthlySpentGoal` is now used in various places, such as in the
`onSave` closure and in the `hasChanges` function. The purpose of these changes is to add a new
feature that allows users to set a monthly spending goal for their wallets, which can be
updated and saved with other wallet information.
The changes include:
- Adding a new `@State` variable `monthlySpentGoal`.
- Updating the `onSave` closure to include `monthlySpentGoal`.
- Using `monthlySpentGoal` in the `hasChanges` function to determine if the wallet's spending
goal has changed.
- Adding a new section `WalletGoalSpentSection` that uses `monthlySpentGoal`.
- Updating the `onSetAsMain` function to use `monthlySpentGoal`.
</reasoning>
Add monthly spending goal feature to WalletManagerView
This commit adds a new `@State` variable `monthlySpentGoal` to the `WalletManagerView` and
updates the `onSave` closure and related functions to include and use this variable. This
feature allows users to set and save a monthly spending goal for their wallets, enhancing the
wallet management functionality.
Tips for Best Results
- Clear Diffs: Use small, focused diffs for more accurate messages.
- Proper Formatting: Ensure your diff is well - formatted for the model to interpret it correctly.
- Output Handling: When using the API, parse the response to separate reasoning and the commit message if needed.
📄 License
No license information provided in the original document.
Other Information
Information Table
Property |
Details |
Model Type |
Summarization |
Training Data |
Tavernari/git - commit - message - dt |
Metrics |
Accuracy |
Tips
⚠️ Important Note
This tool is still evolving. Please review generated messages for accuracy before committing.
💡 Usage Tip
- Use small, focused diffs for more accurate messages.
- Ensure your diff is well - formatted for the model to interpret it correctly.
- When using the API, parse the response to separate reasoning and the commit message if needed.
Feedback and Contributions
This is a community - driven project, and your input helps it grow!
- Feedback: Use the community tab to give us feedback.
- Support: If you’d like to fuel this passion project, consider a donation: Buy me a coffee ☕️.
Get in Touch
I’d love to hear from you! Connect with me at:
Let’s make AI - powered development even better together!