Skip to content

AlvaroHoux/gito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐙 Gito

A Go-based CLI tool designed to streamline AI-assisted commits. Gito captures your staged changes to provide instant context for LLMs, making it effortless to generate accurate, Conventional Commit messages.

Gito acts as a bridge between your code and AI. It natively integrates with Ollama to generate commits automatically on your local machine. If Ollama is offline, Gito smartly falls back to copying your diff and a specialized system prompt directly to your clipboard, so you can paste it into ChatGPT, Gemini, or Claude.

✨ Features

  • Local AI Integration: Connects directly to Ollama to generate commit messages without leaving the terminal.
  • Smart Fallback (Clipboard): If Ollama isn't running, it copies the git diff + a meticulously crafted prompt directly to your clipboard (wl-copy, pbcopy, or clip).
  • Conventional Commits: The built-in prompt ensures your commits always follow standard formatting (e.g., feat:, fix:, refactor:).
  • Interactive or Silent: Prompts for confirmation before applying the commit, or accepts the -y flag to skip the prompt.
  • Cross-Platform: Works seamlessly on Linux (Wayland/X11), macOS, and Windows.

🚀 Installation

Ensure you have Go installed on your machine.

go install github.com/AlvaroHoux/gito/cmd/gito@latest

Make sure your Go bin directory is in your system's $PATH.

🛠️ Prerequisites

  • Git: Must be installed and initialized in your repository.
  • Ollama (Optional but recommended): For local AI generation.
    • Install from ollama.com
    • Pull a model, e.g., ollama pull granite3.3:2b

💻 Usage

First, stage your changes as you normally would:

git add .

Then, just run:

gito

Flags and Options

Skip Confirmation: Apply the generated commit immediately without asking.

gito -y

Specify a Model: Temporarily use a different Ollama model for this commit.

gito -m llama3

Copy Diff Only: Quickly copy the staged diff to your clipboard without any AI prompts, working universally across OSes.

gito -d

Configuration

You can set a default model, or configure Gito to always skip prompts (-y) or only copy diffs (-d). Gito saves this safely in your OS's native config directory (~/.config/gito/config.json on Linux).

gito config -m granite3.3:2b -y

Note: To disable a boolean setting later, you must use the = sign:

gito config -y=false -d=false

Run gito config without any flags to see your current setup!

📝 The Prompt & Customization

Gito comes with a carefully crafted, built-in system prompt (you can check it out in the prompt.txt file in this repository). If you prefer using a web interface, you can also use this exact prompt via our Official Gito GEM.

However, if you want to enforce specific rules for your team locally (e.g., "always use emojis", "write in Portuguese", or "reference Jira tickets"), you can easily override the default prompt.

Simply create a prompt.txt file in Gito's configuration directory:

  • Linux: ~/.config/gito/prompt.txt
  • Windows: %APPDATA%\gito\prompt.txt
  • macOS: ~/Library/Application Support/gito/prompt.txt

If this file exists, Gito will automatically use its contents instead of the default prompt!

🧠 How the Fallback Works

If you run gito and the Ollama server is not active, the CLI won't crash. Instead, it captures your git diff --staged and copies the entire block to your clipboard.

You will see: 🐙 Gito: Copied to clipboard!. Just Ctrl+V into your favorite web AI, and it will give you the perfect commit message.

For Gemini Users: We have an official Gito GEM pre-configured with our exact system prompt. If you are using the fallback, just open the GEM and paste your diff there!


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A Go-based CLI tool designed to streamline AI-assisted commits. Gito captures your staged changes to provide instant context for LLMs and GEMs, making it effortless to generate accurate and descriptive commit messages.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages