---
layout: single
title:  "git pull 批量更新多个仓库"
date:   2025-04-04 08:00:00 +0800
categories: [编程开发, 操作系统]
tags: [git, pull]
---

## git -C <目录> pull

这个命令用于从远程仓库获取最新代码并合并到当前分支。`-C` 选项允许你在指定的目录中运行 git 命令，而不需要先切换到那个目录。


## 下面是 MCP 相关的仓库

```bash
create-python-server
create-typescript-server
docs
inspector
python-sdk
quickstart-resources
servers
specification
typescript-sdk
```

## 更新所有仓库

### 方法一：手动更新

```bash
cd create-python-server && git pull && cd ..
cd create-typescript-server && git pull && cd ..
cd docs && git pull && cd ..
cd inspector && git pull && cd ..
cd python-sdk && git pull && cd ..
cd quickstart-resources && git pull && cd ..
cd servers && git pull && cd ..
cd specification && git pull && cd ..
cd typescript-sdk && git pull && cd ..
```

### 方法二：使用 git -C 命令

```bash
git -C create-python-server pull && \
git -C create-typescript-server pull && \
git -C docs pull && \
git -C inspector pull && \
git -C python-sdk pull && \
git -C quickstart-resources pull && \
git -C servers pull && \
git -C specification pull && \
git -C typescript-sdk pull
```

### 方法三：使用 git -C 命令（带提示）

```bash
echo "🚗 create-python-server" && git -C create-python-server pull && \
echo "🚗 create-typescript-server" && git -C create-typescript-server pull && \
echo "🚗 docs" && git -C docs pull && \
echo "🚗 inspector" && git -C inspector pull && \
echo "🚗 python-sdk" && git -C python-sdk pull && \
echo "🚗 quickstart-resources" && git -C quickstart-resources pull && \
echo "🚗 servers" && git -C servers pull && \
echo "🚗 specification" && git -C specification pull && \
echo "🚗 typescript-sdk" && git -C typescript-sdk pull
```
