git_checkout
Switch between git branches, tags, or commits, or create a new branch and switch to it. Preview impact before discarding local changes.
Instructions
Switch to an existing branch, tag, or commit, optionally creating a branch first. Use this to move between branches for different features, to jump to a tag or historical commit, or to start a new branch with create_branch. Does NOT discard local changes without confirmation: force=True discards them and requires confirmed=True — run preview=True first to see what would be discarded, or git_stash to keep changes. Best for: moving between branches to work on different features. Returns: 'Switched to branch ' on success, or an impact preview when preview=True; use git_branch to list what is available to switch to.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force checkout: discard local changes, or replace an existing branch when create_branch is set | |
| target | No | Branch or commit to switch to | |
| preview | No | Preview the checkout impact (target and files that would be discarded) without executing | |
| confirmed | No | Explicit confirmation required when force is True | |
| repo_path | No | Path to the git repository, defaults to '.' (the server working directory) | . |
| create_branch | No | Create and switch to a new branch |