Version control systems are unforgiving. GitGuard bridges the gap between powerful functionality and developer safety. GitGuard lets you describe Git actions in plain English and safely converts them into real Git commands with explanations and automatic rollback checkpoints.
GitGuard is an AI-powered CLI tool designed to interpret your intent, evaluate risk, and provide automatic recovery checkpoints before risky Git operations are executed. It acts as a dedicated safety and reasoning layer for your version control workflow.
Git is powerful but dangerous. Operations like reset, rebase, and force push can permanently delete work. GitGuard is an AI copilot that:
- Interprets Intent: Describe what you want in plain English.
- Evaluates Risk: Automatically flags operations as Safe, Medium, or High risk.
- Enables Recovery: Creates automatic checkpoints (and stashes local work) before operations.
- Teaches Git: Explains what each command does so you learn while you work.
Git aliases automate commands. GitGuard reasons about intent, evaluates risk, and prepares recovery checkpoints.
Git aliases blindly expand commands. GitGuard evaluates intent, explains impact, creates a recovery point, then asks for confirmation.
pipx install gitguard-cli
pip install gitguard-cli
GitGuard requires a Google Gemini API Key. Get one for free here.
Windows (PowerShell):
$env:GEMINI_API_KEY="your_api_key_here"Linux / macOS:
export GEMINI_API_KEY="your_api_key_here"Describe your intent, and GitGuard will generate a safe plan.
gitguard run "undo my last commit but keep the files"Made a mistake? Revert your repository AND your uncommitted local changes instantly.
gitguard rollbackAutomatically generate semantic, high-quality commit messages from your staged changes.
gitguard commitScan your staged code for hardcoded secrets, API keys, and common bugs before you commit.
gitguard auditGenerates a plain-English summary of your changes—perfect for PR descriptions or standups.
gitguard explainDon't just run commands, understand them.
gitguard learn "git rebase -i HEAD~3"> gitguard run "push my changes"
[Interpreted Action]
• This will push your local 'main' branch to the remote 'origin'.
• Risk Level: MEDIUM
💡 Learning Note:
Pushing sends your local commits to a central server so others can see them.
Planned Commands:
1. git push origin main
Proceed with this plan? [y/N]: y
✓ Checkpoint created: gitguard-backup-20251230_1400
Executing: git push origin main
✓ Done
Success! Operation completed safely.
- GitGuard does not upload your repository.
- Only high-level intent and minimal command context are sent to the AI API.
- No code is stored or logged by GitGuard.
- GitGuard does not replace Git expertise; it adds a safety layer.
- All commands require user confirmation before execution.
- AI interpretation may occasionally need clarification for complex workflows.
- Currently tested primarily on Git repositories using standard workflows.
Distributed under the MIT License. See LICENSE for more information.