git从远程库下载dev分支并关联远程分支

1.在存储文件夹打开命令行

C:\Users\sky\VsCodeProjects\search-archives-fe>


2.初始化

git init

C:\Users\sky\VsCodeProjects\search-archives-fe> git init


3.关联远程库

git remote add origin +远程主地址

C:\Users\sky\VsCodeProjects\search-archives-fe> git remote add origin 地址


4.拉取远程分支

git fetch origin dev(dev为远程仓库的分支名)

C:\Users\sky\VsCodeProjects\search-archives-fe> git fetch origin dev


5.在本地创建分支dev并切换到该分支

git checkout -b dev(本地分支名称) origin/dev(远程分支名称)

C:\Users\sky\VsCodeProjects\search-archives-fe> git checkout -b dev  origin/dev

Switched to a new branch 'dev'

Branch 'dev' set up to track remote branch 'dev' from 'origin'.

你可能感兴趣的:(git从远程库下载dev分支并关联远程分支)