Git branch
git_branchList, create, switch, or delete local Git branches, optionally including remote-tracking branches. Use it to check the current branch, branch off HEAD, or prune merged branches.
Instructions
List local (and optionally remote-tracking) branches, or create/switch/delete one. Use when: you need the current branch, want to branch off HEAD, switch branches, or prune a merged branch. Avoid when: you need the worktree state (git_status) or a remote PR’s head branch (pr_list). Output: list: current, branches[] {name, current, commit, upstream, track, remote}, branch_count. create/switch/delete: branch, commit/created/switched/deleted/force. Missing branch gives not_found; duplicate name gives conflict.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "git_branch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | No | Optional start ref for action=create (default: HEAD). | |
| name | No | Branch name (required for create/switch/delete). | |
| force | No | true allows deleting an unmerged branch (git branch -D); false uses -d. | |
| action | No | list: local branches (add include_remote=true for origin); current: just the checked-out branch; create/switch/delete: local branch. | list |
| reason | No | Optional why (max 400 chars), audit-logged. | |
| include_remote | No | true includes remote-tracking branches in action=list. |