| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
auto_commit.py is a Python script that automates the process of generating concise, conventional commit messages for your Git repository changes using an LLM (via Ollama). It can commit all changes at once or commit each file separately, with AI-generated commit messages based on the actual diffs.
flowchart TD
A[Start] --> B[Parse Arguments]
B --> C{Get Changed Files}
C -->|No changes| Z[No changes detected.]
C -->|Changes found| D{Commit Per File?}
D -->|Yes| E[For each file:<br>1. Get diff<br>2. Generate commit message<br>3. Commit file]
D -->|No| F[For each file:<br>1. Get diff<br>2. Generate commit message]
F --> G[Combine all messages]
G --> H[Commit all changes with combined message]
E --> I[Done]
H --> I
Z --> I
I[End]
Python 3.7+
This script currently uses the gemma3:4b model.
ollama run gemma3:4b
pip install ollama
If ollama server is running, run the script using the command
python auto_commit.py <repository_path> [single]
Commit all changes in git:
python3 auto_commit.py /Users/ttpho/Documents/GitHub/chat
Commit each file separately:
python3 auto_commit.py /Users/ttpho/Documents/GitHub/chat single
Contributions and ideas are welcome, such as:
Modifying the prompt, model, or LLM provider.
Generating commit messages for individual files or a single message for all files.
Optimize or refactor...
| Back | FazBrowse Home | New Git URL |