Tavernari/git-commit-message
25977
1---2datasets:3- Tavernari/git-commit-message-dt4metrics:5- accuracy6pipeline_tag: summarization7tags:8- git9- commit10- message11---12# Git Commit Message Generator (Reasoning Version)13 14Welcome to the **Git Commit Message Generator**—an AI-powered tool that turns your code diffs into clear, meaningful commit messages with detailed reasoning. Hosted on Hugging Face, 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.15 16**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](https://ollama.com/tavernari/git-commit-message) for more details.17 18**Beta Status**: This version is in beta. Your feedback is essential to refine it further!19 20## Output Format21 22The model outputs two main components wrapped in a structured format:23 241. **Reasoning**: A detailed breakdown of the changes in your diff and the logic behind the commit message.252. **Commit Message**: A concise summary of the changes, followed by a more detailed description.26 27**Example Output**:28 29```30<reasoning>31The diff shows changes in `WalletManagerView.swift`. The most significant changes are the 32addition of a new `@State` variable `monthlySpentGoal` and modifications to existing functions 33and state variables. The `monthlySpentGoal` is now used in various places, such as in the 34`onSave` closure and in the `hasChanges` function. The purpose of these changes is to add a new 35feature that allows users to set a monthly spending goal for their wallets, which can be 36updated and saved with other wallet information.37 38The changes include:39- Adding a new `@State` variable `monthlySpentGoal`.40- Updating the `onSave` closure to include `monthlySpentGoal`.41- Using `monthlySpentGoal` in the `hasChanges` function to determine if the wallet's spending 42goal has changed.43- Adding a new section `WalletGoalSpentSection` that uses `monthlySpentGoal`.44- Updating the `onSetAsMain` function to use `monthlySpentGoal`.45</reasoning>46Add monthly spending goal feature to WalletManagerView47 48This commit adds a new `@State` variable `monthlySpentGoal` to the `WalletManagerView` and 49updates the `onSave` closure and related functions to include and use this variable. This 50feature allows users to set and save a monthly spending goal for their wallets, enhancing the 51wallet management functionality.52```53 54This format gives you both the "why" and the "what" of your commit, enhancing clarity and context.55 56## Using the Model57 58You can interact with the model in two ways:59 60### 1. Web Interface61- Go to the [Hugging Face Model Page](https://huggingface.co/Tavernari/git-commit-message).62- Paste your git diff into the input box.63- Click "Generate" to get the reasoning and commit message.64 65### 2. API Integration66- Use the Hugging Face Inference API to integrate the model into your workflows.67- Example in Python:68 69```python70import requests71 72API_URL = "https://api-inference.huggingface.co/models/Tavernari/git-commit-message"73headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}74 75def query(payload):76 response = requests.post(API_URL, headers=headers, json=payload)77 return response.json()78 79diff = """80diff --git a/file1.py b/file1.py81index 83db48f..bf2a9a2 10064482--- a/file1.py83+++ b/file1.py84@@ -1,3 +1,4 @@85 def hello():86 print("Hello, world!")87+ print("Welcome to AI commit messages!")88"""89output = query({"inputs": diff})90print(output)91```92 93- Replace `YOUR_HF_TOKEN` with your Hugging Face API token. The response will include both reasoning and the commit message.94 95## Tips for Best Results96 97- **Clear Diffs**: Use small, focused diffs for more accurate messages.98- **Proper Formatting**: Ensure your diff is well-formatted for the model to interpret it correctly.99- **Output Handling**: When using the API, parse the response to separate reasoning and the commit message if needed.100 101## Installing `git-gen-commit` (Optional)102 103For a command-line experience, you can install the `git-gen-commit` script, which generates commit messages from your git diff.104 105**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](https://ollama.com/tavernari/git-commit-message).106 107### Installation (macOS/Linux)108Run this command to install `git-gen-commit` globally:109 110```bash111sudo sh -c 'curl -L https://gist.githubusercontent.com/Tavernari/b88680e71c281cfcdd38f46bdb164fee/raw/git-gen-commit \112 -o /usr/local/bin/git-gen-commit && chmod +x /usr/local/bin/git-gen-commit'113```114 115### Usage116Once installed, run:117 118```bash119git gen-commit120```121 122This will analyze your current git diff and generate a commit message via the Ollama API.123 124## Feedback and Contributions125 126This is a community-driven project, and your input helps it grow!127 128- **Feedback**: Use the community tab to give us feedback.129- **Support**: If you’d like to fuel this passion project, consider a donation: [Buy me a coffee ☕️](https://donate.stripe.com/14k3d8dFqfeI96E8ww).130 131## Disclaimer132 133This tool is still evolving. Please review generated messages for accuracy before committing.134 135## Get in Touch136 137I’d love to hear from you! Connect with me at:138 139- [LinkedIn](https://www.linkedin.com/in/victorctavernari/)140- [GitHub](https://github.com/Tavernari)141- [Twitter](https://twitter.com/vituu)142- Email: victortavernari+gitcommitmessage@gmail.com143 144Let’s make AI-powered development even better together!