# git如何拉取指定分支（远程仓库）代码

**问题背景：**

新项目还在开发阶段，没有正式对外发布，所以开发同事合并代码到develop上(或者其他名称分支上)，而不是到master分支上

通过git拉取代码的时候，默认拉取的是master分支，如下图：

![](/files/-LtdvBgumS3SOqHw5EgJ)

**拉取指定分支代码解决方案：**

**1.使用git命令拉取**

命令：`$ git clone -b develop git@192.168.101.107:unioncloud-separate/aicall.git`其中develop就是远程分支的名称

![](/files/-LtdvBgwG8zaMmo9juPV)

2.当clone 下来只有master分支时，可以才用：取远程分支并在本地分化一个新分支的方案

```
进入项目目录
git checkout -b 远程仓库分支名字
git pull origin 远程仓库分支名字
```

3.**使用TortoiseGit工具拉取**

![](/files/-LtdvBgy6PX1JfpmwSD_)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tuonioooo-notebook.gitbook.io/engineering-management/gityuan-ma-guan-li/gitming-ling-xiang-jie/gitru-he-la-qu-zhi-ding-fen-zhi-ff08-yuan-cheng-cang-ku-ff09-dai-ma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
