|
4 gün önce | |
---|---|---|
Dockerfile | 4 gün önce | |
Makefile | 4 gün önce | |
README.md | 5 gün önce | |
ai-commit.sh | 4 gün önce | |
git_commit_ai.py | 4 gün önce | |
git_rebase_ai.py | 4 gün önce | |
git_reword_ai.py | 4 gün önce |
This tool automatically generates Git commit messages based on your staged changes using the Google Gemini API. It analyzes the diff of your staged files and suggests a commit message following conventional commit standards.
Build the Docker Image:
docker build -t docker.senomas.com/commit:1.0 .
(Note: The tag docker.senomas.com/commit:1.0
is used in the ai-commit.sh
script. You can change it if needed, but make sure to update the script accordingly.)
Set Environment Variable: Export your Gemini API key as an environment variable:
export GEMINI_API_KEY='YOUR_API_KEY'
(Replace YOUR_API_KEY
with your actual key. You might want to add this line to your shell profile (e.g., .bashrc
, .zshrc
, config.fish
) for persistence.)
git add
to stage the files you want to include in the commit.For a new commit: Execute the ai-commit.sh
script from the root of your Git repository:
./ai-commit.sh
To amend the previous commit: Use the -a
or --amend
flag:
./ai-commit.sh -a
# or
./ai-commit.sh --amend
y/n
).ai-commit.sh
script runs the git_commit_ai.py
script inside a Docker container (docker.senomas.com/commit:1.0
).pwd
) as /repo
inside the container, allowing the script to access your Git repository..gitconfig
and .git-credentials
(read-only) for Git operations within the container.GEMINI_API_KEY
environment variable into the container.ai-commit.sh
(like -a
or --amend
) to the Python script inside the container.git_commit_ai.py
script:
--amend
).git diff --staged
.git commit -m "..."
or git commit --amend -m "..."
with the generated message.git_commit_ai.py
: The main Python script that interacts with Git and the Gemini API.Dockerfile
: Defines the Docker image environment.ai-commit.sh
: A helper script to easily run the tool in Docker.README.md
: This file.