拉取远程仓库其他分支到本地

4/10/2023 Git

# 已经有仓库,拉取远程仓库其他分支到本地

在编写其他分支的是时候,为了不污染新的分支,拉去远程仓库新建分支

//已经有仓库,拉取远程仓库其他分支到本地
git checkout -b 新的分支名 远程仓库别名/远程仓库分支名

案例:git checkout -b waterCondition origin/waterCondition

//查看远程已经本地分支
git branch -a


1
2
3
4
5
6
7
8
9
Luffy@DESKTOP-HR34L43 MINGW64 /d/项目/hydraulic/shuihanzaihai-portal (materialsDispatch)
$ git branch -a
  dev
* materialsDispatch
  remotes/origin/HEAD -> origin/main
  remotes/origin/dev
  remotes/origin/main
  remotes/origin/materialsDispatch
  remotes/origin/qa
  remotes/origin/test
  remotes/origin/vite
  remotes/origin/waterCondition
  remotes/origin/wuqiuyan

Luffy@DESKTOP-HR34L43 MINGW64 /d/项目/hydraulic/shuihanzaihai-portal (materialsDispatch)
$ git checkout -b waterCondition origin/waterCondition
Switched to a new branch 'waterCondition'
branch 'waterCondition' set up to track 'origin/waterCondition'.

Luffy@DESKTOP-HR34L43 MINGW64 /d/项目/hydraulic/shuihanzaihai-portal (waterCondition)
$ git status
On branch waterCondition
Your branch is up to date with 'origin/waterCondition'.

nothing to commit, working tree clean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Last Updated: 4/10/2023, 5:06:02 PM