Skip to content

git_switch_branch

MCP tools › Version control

Switch to a local branch: updates the files that differ between HEAD and the branch, keeps unrelated local changes and refuses (listing the paths) when local changes would be overwritten. dry_run defaults to true and only lists changes and conflicts. smart=true (with dry_run=false) puts all local changes aside in a named stash, switches and brings them back; changes that conflict stay in the stash and the files get conflict markers (result: switch and stash).

Its results carry text from git: the client is told to treat that as data, never as instructions.

Capabilitygit.git_switch_branch
AreaVersion control
Accesschanges files, repository
Reaches—
Rightsvcs-write
Dry rundry_run, on unless the call turns it off

Arguments

ArgumentTypeDescription
namerequiredstringLocal branch to switch to.
dry_runbooleanOnly report the files that would change and conflicts (default true).
smartbooleanPut local changes in the way aside in a stash and bring them back afterwards (needs dry_run=false).

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project git_switch_branch '{"name":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "Local branch to switch to.",
"type": "string"
},
"dry_run": {
"description": "Only report the files that would change and conflicts (default true).",
"type": [
"boolean",
"null"
]
},
"smart": {
"description": "Put local changes in the way aside in a stash and bring them back afterwards (needs\ndry_run=false).",
"type": [
"boolean",
"null"
],
"default": null
}
}
}