Skip to content

Branch tools manage the full lifecycle of Git branches — listing, creating, deleting, renaming, checking out, and setting tracking relationships.

git_list_branches

Lists local branches. Optionally includes remote-tracking branches.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
allbooleanfalseInclude remote-tracking branches
response_format"markdown" | "json""markdown"Output format

Example:

json
{ "tool": "git_list_branches", "params": { "repo_path": "/home/user/myproject", "all": true } }

git_create_branch

Creates a new branch, optionally from a specified ref.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
namestring*Name for the new branch
from_refstringHEADStarting point (commit, branch, or tag)
checkoutbooleanfalseAlso switch to the new branch after creating it
response_format"markdown" | "json""markdown"Output format

Example:

json
{
  "tool": "git_create_branch",
  "params": {
    "repo_path": "/home/user/myproject",
    "name": "feature/login",
    "from_ref": "main",
    "checkout": true
  }
}

git_delete_branch

Deletes a local branch.

WARNING

Use force: true only when you are certain the branch's commits are reachable from another ref. Without it, Git refuses to delete a branch that has not been merged.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
namestring*Branch to delete
forcebooleanfalseDelete even if the branch has unmerged commits
response_format"markdown" | "json""markdown"Output format

Example:

json
{
  "tool": "git_delete_branch",
  "params": { "repo_path": "/home/user/myproject", "name": "feature/login" }
}

git_rename_branch

Renames a local branch.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
old_namestring*Current branch name
new_namestring*New branch name
response_format"markdown" | "json""markdown"Output format

Example:

json
{
  "tool": "git_rename_branch",
  "params": {
    "repo_path": "/home/user/myproject",
    "old_name": "feature/login",
    "new_name": "feature/auth"
  }
}

git_checkout

Switches the working tree to a branch, tag, or commit. Equivalent to git switch / git checkout.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
refstring*Branch, tag, or commit to check out
createbooleanfalseCreate the branch if it does not exist (equivalent to -b)
response_format"markdown" | "json""markdown"Output format

Example:

json
{
  "tool": "git_checkout",
  "params": { "repo_path": "/home/user/myproject", "ref": "main" }
}

git_set_upstream

Sets the upstream (tracking) remote branch for a local branch.

ParameterTypeRequiredDefaultDescription
repo_pathstring*Absolute path to the repository
branchstring*Local branch name
upstreamstring*Remote tracking ref in the form remote/branch (e.g. origin/main)
response_format"markdown" | "json""markdown"Output format

Example:

json
{
  "tool": "git_set_upstream",
  "params": {
    "repo_path": "/home/user/myproject",
    "branch": "feature/auth",
    "upstream": "origin/feature/auth"
  }
}

Released under the MIT License.