Back to Codex
Dev Tools·
intermediate
·8 min read·Apr 4, 2026

How to Use the Git MCP Server for Version Control Operations

Manage local Git repositories through AI agents. Clone repos, create branches, make commits, and view diffs using the Git MCP server.

Gitversion controlcommitsbranchesdiff

Use the Git MCP Server for Version Control

The Git MCP server provides AI agents with access to local Git repositories, enabling version control operations through natural language.

Configuration

json
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git", "--repository", "/path/to/your/repo"]
    }
  }
}

For multiple repositories:

json
{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository", "/path/to/repo1",
        "--repository", "/path/to/repo2"
      ]
    }
  }
}

Available Tools

ToolDescription
code
git_status
Show working tree status
code
git_diff_unstaged
Show unstaged changes
code
git_diff_staged
Show staged changes
code
git_commit
Create a commit
code
git_add
Stage files
code
git_reset
Unstage files
code
git_log
View commit history
code
git_create_branch
Create a new branch
code
git_checkout
Switch branches
code
git_show
Show a specific commit

Example Workflows

Code Review

code
"Show me the unstaged changes and suggest a meaningful commit message"

Branch Management

code
"Create a new feature branch called 'add-auth' from main"

History Analysis

code
"Show the last 20 commits and summarize what changed this sprint"

Change Tracking

code
"What files have been modified since the last commit?"

Combining with Other Servers

  • GitHub server + Git server = Complete code workflow
  • Filesystem server + Git server = Edit files and commit changes
  • Sentry server + Git server = Find bug-introducing commits

Tips

  • The AI can help write descriptive commit messages based on diffs
  • Use for automated changelog generation
  • Great for onboarding — AI can explain repository history