A command-line tool that uses the gemini-cli to generate Git commit messages from your staged changes.
-
Clone the repository:
git clone https://github.com/your-username/gemmit.git cd gemmit
-
Install:
pip install .
-
Update your shell profile:
Add the following line to your
~/.bashrc
,~/.zshrc
, or other shell profile:export PATH="$HOME/.gemmit:$PATH"
gemmit [options] <template>
To remove gemmit
and its configuration from your system, follow these steps:
-
Uninstall the package:
pip uninstall gemmit
-
Remove the configuration directory:
rm -rf ~/.gemmit
gemmit
works by sending the output of git diff --cached
(your staged changes) to the local gemini-cli
agent to generate a commit message. Be mindful of this when staging sensitive information.
By default, gemmit
runs in an interactive mode that allows you to review, edit, or regenerate the commit message before committing.
--- Generated Commit Message ---
feat: Add interactive commit message workflow
The previous implementation was a simple, one-shot operation that
generated a commit message, leaving the user to either accept it
as-is or abort.
This patch introduces a new interactive workflow for commit message
generation, providing a more powerful and user-friendly experience.
The key changes are:
- The `generate` command now enters an interactive loop after creating
the first message.
- Four options are provided:
- [Y]es: Accept the message and proceed with the commit.
- [E]dit: Open the message in the default system editor ($EDITOR)
for manual changes.
- [R]egenerate: Discard the current message and generate a new one.
- [N]o: Abort the commit process.
- The main script invokes this interactive mode by default.
--------------------------------
Use this message? [Y]es, [E]dit, [R]egenerate, [N]o:
- [Y]es: Accepts the message and commits.
- [E]dit: Opens the message in your default text editor for manual changes.
- [R]egenerate: Generates a new message using the same template.
- [N]o: Aborts the commit.
Note: The "Edit" feature relies on the $EDITOR
environment variable. Make sure it is configured in your shell profile (e.g., export EDITOR=vim
). If it's not set, it will default to vim
.
Flags can be combined (e.g., -apy
).
-a
: Stage all tracked files (git add .
) before generating the message.-p
: Push changes to the remote repository (origin <branch>
) after a successful commit.-y
: (YOLO mode) Skip the interactive confirmation and commit directly.-h
: Show the help message.
1. Basic Commit
Stage your files manually, then generate a commit message using the kernel
template.
# Stage your changes
git add src/gemmit.py
# Generate the commit message
gemmit kernel
2. Stage, Commit, and Push
An end-to-end workflow: stage all files, generate and confirm the message, and push to the remote repository.
# combined --add --push --yes
gemmit -apy kernel
If you omit the <template>
argument, gemmit
will use the default_template
specified in your ~/.gemmit/config.json
file. The initial default is kernel
.
You can customize templates and behavior by editing ~/.gemmit/config.json
.
templates
: Define your own templates with custom prompts.default_template
: Set the template to be used by default when no template is specified.autoconfirm
: Set totrue
to make the-y
flag the default behavior.highlight_color
: Set a hex color code (e.g.,#FFA500
) forgemmit
's output.