Git History Rewrite
git_rewriteRewrite Git commit history by rewording, squashing, or replacing messages, with backup and restore actions; create a backup before force-pushing changed hashes.
Instructions
Rewrite commit history. Use action=reword|squash|rewrite-messages|backup|restore. History rewriting changes commit hashes and requires force-push; create a backup first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "git_rewrite"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Commit ref to reword (defaults to HEAD). | |
| name | No | Backup branch name (backup/restore). | |
| count | No | Number of commits to squash. | |
| range | No | Commit range to rewrite (e.g. HEAD~5..HEAD). | |
| action | Yes | History rewrite operation. | |
| confirm | No | Confirm destructive history rewrite. | |
| message | No | New commit message (reword/squash). | |
| messages | No | Map of commit SHA to replacement message (rewrite-messages). | |
| repo_path | No | Absolute path to the local Git repository. If omitted, falls back to the server default set via the GIT_REPO_PATH environment variable or --repo-path CLI argument. | |
| response_format | No | Output format for the response. | markdown |