git_merge
Merge a branch into your current working branch to integrate changes from development work. Supports merge commits and abort options for version control management.
Instructions
Merge a branch into current branch
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | Yes | Branch to merge into current branch | |
| cwd | No | Repository directory | |
| noFf | No | Create merge commit even if fast-forward is possible | |
| abort | No | Abort current merge |
Implementation Reference
- src/tools/git.ts:314-320 (handler)The main handler function that executes the git merge command using executeGitCommand, supporting abort and no-ff options.export async function gitMerge(args: z.infer<typeof gitMergeSchema>): Promise<ToolResponse> { if (args.abort) { return executeGitCommand('git merge --abort', args.cwd); } const noFfFlag = args.noFf ? '--no-ff' : ''; return executeGitCommand(`git merge ${noFfFlag} ${args.branch}`.trim(), args.cwd); }
- src/tools/git.ts:141-146 (schema)Zod schema defining input parameters for the git_merge tool, used for validation.export const gitMergeSchema = z.object({ branch: z.string().describe('Branch to merge into current branch'), cwd: z.string().optional().describe('Repository directory'), noFf: z.boolean().optional().default(false).describe('Create merge commit even if fast-forward is possible'), abort: z.boolean().optional().default(false).describe('Abort current merge') });
- src/index.ts:401-403 (registration)Registration in the main MCP server tool dispatcher: validates arguments and calls the gitMerge handler for 'git_merge' tool calls.if (name === 'git_merge') { const validated = gitMergeSchema.parse(args); return await gitMerge(validated);
- src/tools/git.ts:643-656 (registration)MCP tool specification in gitTools array, defining name, description, and input schema for listing tools.{ name: 'git_merge', description: 'Merge a branch into current branch', inputSchema: { type: 'object', properties: { branch: { type: 'string', description: 'Branch to merge into current branch' }, cwd: { type: 'string', description: 'Repository directory' }, noFf: { type: 'boolean', default: false, description: 'Create merge commit even if fast-forward is possible' }, abort: { type: 'boolean', default: false, description: 'Abort current merge' } }, required: ['branch'] } },