xgit — AI-powered Git workflows: resolve conflicts, debug regressions, and review diffs from your terminal.
curl -fsSL https://raw.githubusercontent.com/hjun1052/xgit/main/scripts/install.sh | bashirm https://raw.githubusercontent.com/hjun1052/xgit/main/scripts/install.ps1 | iexgit clone https://github.com/hjun1052/xgit.git
cd xgit
go build -o xgit ./cmd/xgit
./xgit init --provider mock --non-interactiveInput
xgit commitExample output
feat(auth): add refresh token rotation
- rotate refresh tokens on every successful refresh
- invalidate previous token family on reuse detection
- add tests for replay and expiry behavior
Input
xgit review --base mainExample output
Risk score: medium
- [auth/service.go] Missing nil-check on token claims can panic
- [api/handler.go] 401/403 paths are inconsistent for expired sessions
Suggested fixes:
1) Guard claims before type assertions
2) Normalize auth error mapping in middleware
Input
xgit mergeExample output
Generated patch (preview):
diff --git a/auth/service.go b/auth/service.go
...
Patch check passed. Apply this patch now? [y/N]:
Input
xgit hist-debug --good v1.2.0 --bad HEAD --test "go test ./..." --flaky-retries 3 --format jsonExample output
{
"first_bad_commit": "944424a9a28c9f2c1a1703ae05f964e140a3b35e",
"analysis": "Off-by-one introduced in Add(): return a + b + 1",
"patch_detected": true
}Input
xgit test-fix --test "go test ./..."Example output
Generated test-fix patch:
diff --git a/calc.go b/calc.go
...
Re-running tests: go test ./...
ok project/calc 0.114s
Git is excellent at storing snapshots and tracking text changes, but it does not understand code intent.
xgit bridges that gap:
- Keep using normal Git repositories and workflows
- Add semantic reasoning only where it helps (merge, review, debugging)
- Preserve human control with patch validation + approval gates
In short: xgit is not a new VCS. It is a practical AI layer over the Git you already use.
-
AI merge conflict resolution (
xgit merge)- Context-aware conflict analysis
- Unified diff generation +
git apply --checkvalidation - Safe fallback for complex conflicts (submodule/symlink/binary/rename variants)
-
Regression debugging (
xgit hist-debug)git bisectorchestration + AI root-cause analysis- Supports flaky test handling (
--flaky-retries) - Optional patch suggestion + validation
-
Commit/review productivity
xgit commit: generate high-quality commit messages from diffsxgit review: structured risk-focused diff reviewxgit enhance: low-risk refactor suggestions from current changesxgit explain history: summarize commit timeline, turning points, and hotspots
-
Automation helpers
xgit test-fix: propose and validate fixes for failing testsxgit doc: generate/update project docsxgit auto: state-aware automation (conflict/test/diff driven)
-
Workflow scaling
xgit alias: compose multiple xgit commands into one reusable commandxgit rebase: AI-assisted rebase conflict handlingxgit safe-refactor: conservative patch + validation + rollbackxgit pr-split: suggest/apply logical PR chunking by file groupsxgit deadcode: heuristic dead/unused code candidate discovery
-
Provider flexibility
- API providers: OpenAI, Claude, Ollama
- CLI provider: codex-cli
- Mock provider for local testing
-
Production-minded resilience
- Retry/backoff for transient model/API failures
- Partial-output parsing fallback for malformed responses
- Prompt budget management for large diffs/logs
- Built-in terminal progress spinner for long-running steps (AI calls/bisect/tests)
- Optional debug telemetry (
XGIT_DEBUG=1)
xgit init --provider codex-cli --non-interactive
# or:
xgit config set provider openai
xgit config set api-key-env openai OPENAI_API_KEY# Generate commit message from staged diff
xgit commit
# Review current branch changes vs main
xgit review --base main
# Suggest improvements on current diff
xgit enhance --focus readability
# Explain recent branch history
xgit explain history main..HEAD --limit 40# Resolve active merge conflicts
xgit merge
# or bias resolution direction with custom guidance
xgit merge --direction ours --guidance "prefer API compatibility and keep current error handling"
# by default merge blocks patches touching non-conflict files
xgit merge --allow-out-of-scope
# Automate next best action based on repo state
xgit auto --base main
# Rebase with AI conflict resolver
xgit rebase main --auto-resolve
# Create reusable command bundles
xgit alias set ship "review --base main" "commit --apply"
xgit ship
# Find and analyze regression introduction
xgit hist-debug --good v1.2.0 --bad HEAD --test "go test ./..." --flaky-retries 3
# Auto-fix failing tests (with patch validation)
xgit test-fix --test "go test ./..."
# Split branch into logical PR chunks
xgit pr-split --base main
# Heuristic dead code discovery
xgit deadcode --lang go
# Security toggles
xgit config set allow-shell off
xgit config set prompt-redaction on- Best validated on macOS/Linux. Windows support is included, but deep real-world validation is still ongoing.
- AI output quality depends on provider/model and prompt context budget.
- Very large/binary-heavy repositories may require narrower command scope for best results.
xgitalways prefers safe fallback over risky auto-edits when confidence is low.
| Tool | What it does well | Limits | Where xgit fits |
|---|---|---|---|
| Git CLI | Reliable history/snapshots/branching | No semantic reasoning for intent/conflicts | Adds AI reasoning while keeping native Git flow |
| General AI coding agents | Broad code generation and refactor support | Not Git-workflow-centric by default | Purpose-built commands for merge/review/bisect workflows |
| PR review bots | Automated PR comments in hosted workflows | Mostly post-hoc, remote, PR-stage | Works locally during development before PR |
| Custom scripts + hooks | Team-specific automation | Hard to maintain, limited inference | Reusable AI-assisted CLI with validation and fallbacks |
If this project is useful, please consider starring the repo and opening issues for edge cases you want covered next.
- Changelog: CHANGELOG.md
- Maintainer release checklist: RELEASE.md