Git Integration
PraisonAI CLI provides deep Git integration for tracking changes, auto-committing with AI-generated messages, and managing your version control workflow seamlessly.
Overview
Git integration features:
- Auto-commit - Commit with AI-generated messages
- Diff viewing - Rich diff display with syntax highlighting
- Undo support - Safely undo AI changes
- Branch management - Create and switch branches
- Stash support - Stash and restore changes
Quick Start
CLI Commands
/diff
Show current changes:
/commit
Commit with AI-generated message:
/undo
Undo the last commit:
Operator slash commands
Five /git-* commands drive GitManager directly from a praisonai code session.
These are operator commands, not agent tools. Committing is a decision, not a step the model should take on its own — so the agent can’t call them. The same reasoning keeps /map operator-only.
They sit alongside the older /diff, /commit, /undo — the /git-* names are the explicit, git-scoped surface backed by GitManager (get_status, get_diff_content, get_log, commit, undo).
/git-status parsing was fixed alongside these commands: get_status() previously ran .strip() on the whole porcelain output, eating the leading space of the first line, so " M a.txt" parsed as status "M " and path ".txt" — reported as staged. It now strips only trailing newlines, so " M a.txt" is correctly modified, not staged.
Python API
Basic Usage
Status
Diff
Commit
Undo
Log
Git Manager
For more control, use GitManager directly:
Commit Message Generation
Automatic Generation
Message Styles
Conventional (default):
Simple:
Detailed:
Diff Viewer
Rich Display
Output Example
Integration with Autonomy Modes
Git operations respect autonomy settings:
Best Practices
Safe Workflow
- Review diff first - Always check
/diff before committing
- Use meaningful messages - Edit AI messages if needed
- Commit frequently - Small, focused commits
- Use branches - Create branches for experiments
Commit Message Guidelines
Undo Strategy
Configuration
Environment Variables
Git Config
Error Handling