Skip to main content
Glama

git_checkout

Switch between branches in a Git repository to access different code versions or development lines.

Instructions

Switches branches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
branch_nameYes

Implementation Reference

  • The main handler function that performs the git checkout operation on the given repository and branch.
    def git_checkout(repo: git.Repo, branch_name: str) -> str: repo.git.checkout(branch_name) return f"Switched to branch '{branch_name}'"
  • Pydantic model defining the input schema for the git_checkout tool, including repo_path and branch_name.
    class GitCheckout(BaseModel): repo_path: str branch_name: str
  • Registration of the git_checkout tool in the list_tools handler, using the name from GitTools.CHECKOUT and GitCheckout schema.
    Tool( name=GitTools.CHECKOUT, description="Switches branches", inputSchema=GitCheckout.schema(), ),
  • Enum value in GitTools defining the tool name 'git_checkout'.
    CHECKOUT = "git_checkout"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/martinsky999/mcp-git-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server