Skip to main content
Glama

git_commit

Create a Git commit with a specified message to save changes in a repository. This tool helps track project progress by recording modifications with descriptive messages.

Instructions

Create a commit with the specified message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
messageYesThe commit message

Implementation Reference

  • The handler function that executes the git_commit tool: creates a commit in the specified repository using simpleGit.commit() on staged changes.
    * Creates a commit with the specified message * @param {string} repoPath - Path to the local repository * @param {string} message - Commit message * @returns {Object} - Commit result */ export async function handleGitCommit({ repo_path, message }) { try { const git = simpleGit(repo_path); // Create the commit (only commit what's in the staging area) const commitResult = await git.commit(message); return { content: [ { type: "text", text: JSON.stringify( { success: true, commit_hash: commitResult.commit, commit_message: message, summary: commitResult.summary, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to create commit: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
  • JSON schema definition for the git_commit tool input parameters (repo_path and message).
    name: "git_commit", description: "Create a commit with the specified message.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, message: { type: "string", description: "The commit message", }, }, required: ["repo_path", "message"], }, },
  • src/server.js:907-907 (registration)
    Maps the tool name 'git_commit' to its handler function handleGitCommit in the central handlersMap.
    git_commit: handleGitCommit,
  • Re-exports the handleGitCommit handler from commit-operations.js for use in server.js.
    handleGitCommit,
  • Imports the handleGitCommit function from the commit-operations module.
    handleGitCommitHistory, handleGitCommitsDetails, handleGitCommit, handleGitTrack, } from "./commit-operations.js";

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