git-hex

AI-assisted, non-interactive git refactoring via MCP — a focused toolset for rebase & commit perfection, usable by agents or chat users directing the MCP tools.
git-hex is an MCP (Model Context Protocol) server that provides AI assistants with safe, powerful git refactoring capabilities. It handles the complexity of interactive rebasing, fixup commits, and commit amendments while ensuring your repository is never left in a broken state.
Name note: “git-hex” is simply a short label for this git-history refactoring toolkit (not related to hex encoding).
See CHANGELOG.md for notable changes. Version metadata also lives in VERSION and .claude-plugin/plugin.json.
Quick links: docs/install.md • docs/safety.md • docs/clients.md • docs/reference/tools.md • docs/reference/mcp.md • SECURITY.md • CONTRIBUTING.md
Table of contents
Design Principles
- Safety first: Conflict-prone operations abort cleanly by default and create backup refs so you can always undo.
- Deterministic git: Focus on well-defined history rewrites (rebase, fixup, amend, split-by-file) with predictable outputs.
- Minimal surface: Tools only—no extra services. Everything runs through the MCP Bash Framework.
- Respect the sandbox: Every path is validated against your client’s allowed folders (MCP
roots); read-only mode blocks mutating tools.
- Agent friendly: Outputs are structured, include summaries, and prefer explicit parameters over magic.
Features
- Safe Rebasing: Automatic abort on conflicts so git-hex operations leave the repo clean if conflicts arise
- Fixup Commits: Create fixup! commits for later auto-squashing
- Commit Amendments: Safely amend the last commit with staged changes
- Cherry-picking: Single-commit cherry-pick with strategy options
- Undo Support: Backup refs for history-mutating operations (amend, fixup, cherry-pick, rebase, split); undo is safe unless new commits were added after the backup (see
force)
- Path Security: All operations respect your client’s allowed folders (MCP
roots) for sandboxed access
Quick Start (2 minutes)
Connect your AI
Claude Code (recommended):
/plugin marketplace add yaniv-golan/git-hex
/plugin install git-hex@git-hex-marketplace
Cursor / Claude Desktop / Windsurf (MCP config):
git clone https://github.com/yaniv-golan/git-hex.git ~/git-hex
Then add to your MCP settings:
{
"mcpServers": {
"git-hex": {
"command": "~/git-hex/git-hex.sh"
}
}
}
Windows (Git Bash): see docs/clients.md#windows-git-bash
Prerequisites: git and jq/gojq. No install step needed — the runtime is included. See docs/install.md.
Verify it works
In your AI chat (in a repo), ask:
“Show me the last 5 commits I could rebase onto main.”
When connected, your AI can use tools like git-hex-getRebasePlan to answer.
Having issues?