git拉取代码最常用的方式为:
git clone http://gitslab.yiqing.com/declare/about.git
这种方式没有指定分支,当代码有多个分支时,拉取的分支不一定就是master。比如,下面这个其实拉下来的就不是master分支代码:
[root@izbp1845cet96se1qmb5ekz home]# git clone http://gitslab.yiqing.com/declare/about.git
Cloning into 'about'...
Username for 'http://gitslab.yiqing.com': account
Password for 'http://account@gitslab.yiqing.com':
remote: Counting objects: 116, done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 116 (delta 45), reused 80 (delta 28)
Receiving objects: 100% (116/116), 313.49 KiB | 508.00 KiB/s, done.
Resolving deltas: 100% (45/45), done.
[root@izbp1845cet96se1qmb5ekz home]# ls
about
[root@izbp1845cet96se1qmb5ekz home]# cd about/
[root@izbp1845cet96se1qmb5ekz about]# git branch
* develop
使用git拉代码时可以使用 -b 指定分支
指定拉 master 分支代码
git clone -b master http://gitslab.yiqing.com/declare/about.git
指定拉 develop 分支代码
git clone -b develop http://gitslab.yiqing.com/declare/about.git
【git 克隆指定分支代码】
查看当前项目拉的是哪个分支的代码:
进入项目根目录, 然后执行 git branch 命令
git branch
如图所示:

文章图片
查看当前项目拉的是哪个分支的代码详情:
进入项目根目录, 然后执行 git branch -vv 命令
git branch -vv
如图:

文章图片

文章图片
查看分支上的递交情况:
进入项目根目录,执行 git show-branch
git show-branch
如图:

文章图片

文章图片
推荐阅读
- transformer|Swin-Transformer代码讲解-Video Swin-Transformer
- git使用技巧备忘(持续更新。。。)
- git 高级操作
- 同步GIT仓库的操作 -- pull命令
- git|git简单命令
- Git|Tomcat 自定义错误页面(例如404页面等等)
- 本地项目添加到gitee仓库管理
- centos|搭建Git服务器
- Git clone~fatal: protocol '?http' is not supported。解决办法。
- github开通,史上最全demo集合,各种demo持续更新中