Skip to main content
Glama

git_pull

Pull changes from a remote Git repository to update your local branch with the latest commits from the specified remote and branch.

Instructions

Pull changes from a remote repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
remoteNoRemote nameorigin
branchNoBranch to pull (default: current branch)
rebaseNoWhether to rebase instead of merge

Implementation Reference

  • Main handler function implementing the git_pull tool. Uses simpleGit to pull from remote repository with optional rebase.
    export async function handleGitPull({ repo_path, remote = "origin", branch = null, rebase = false, }) { try { const git = simpleGit(repo_path); // If no branch specified, use current branch if (!branch) { const branchInfo = await git.branch(); branch = branchInfo.current; } // Set up pull options const pullOptions = {}; if (rebase) { pullOptions["--rebase"] = null; } // Perform the pull const pullResult = await git.pull(remote, branch, pullOptions); return { content: [ { type: "text", text: JSON.stringify( { success: true, result: pullResult, message: `Pulled from ${remote}/${branch}`, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to pull changes: ${error.message}`, conflicts: error.git ? error.git.conflicts : null, }, null, 2 ), }, ], isError: true, }; }
  • Input schema definition for the git_pull tool, defining parameters like repo_path, remote, branch, and rebase.
    name: "git_pull", description: "Pull changes from a remote repository.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, remote: { type: "string", description: "Remote name", default: "origin", }, branch: { type: "string", description: "Branch to pull (default: current branch)", }, rebase: { type: "boolean", description: "Whether to rebase instead of merge", default: false, }, }, required: ["repo_path"], },
  • src/server.js:913-913 (registration)
    Registration of the git_pull handler in the server's handlersMap.
    git_pull: handleGitPull,
  • Re-export of handleGitPull from remote-operations.js for use in server.js
    handleGitPull,
  • src/server.js:891-891 (registration)
    Alias mapping git_fetch to git_pull tool.
    git_fetch: "git_pull",

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/bsreeram08/git-commands-mcp'

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