1.通过git clone的方式
只克隆单一分支:
git clone -b <branch> --single-branch <url>
注意:
git clone -b <branch> <url>
这条克隆的指令与全克隆的作用一致。
2.通过本地分支映射到远程分支的方式
a.与远程仓库建立连接??
git remote add origin http://git.xxx.com:10001/root/vue-upms.git

b.把远程分支拉到本地
git fetch origin 远程仓库的分支名


c.在本地创建分支并切换到该分支,与远程分支映射
git checkout -b 本地分支名称 origin/远程分支名称

d.查看当前本地分支和远程分支的关联状态
git status
e.拉取分支上的内容确认已到本地
git pull origin 远程分支名称

附:下拉更新、上传提交保姆级教程
以master分支为例
//下拉更新(修改代码之前就应该先pull)
git pull origin master
//查看文件状态
git status
//添加所有文件到暂存区
git add .
//添加单个文件
git add file1
//添加多个文件,文件之间以空格隔开
git add file1 file2 file3
//将缓存中的文件Commit到git库
git commit -m 添加你的注释
//提交远程仓库
git push origin master
//查看仓库所有提交状态
git log
新手总是会忘,代码这种事情敲多了就理解记住了。
|