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 branch 命令
git branch
如图所示:
查看当前项目拉的是哪个分支的代码详情:
进入项目根目录, 然后执行 git branch -vv 命令
git branch -vv
如图:
查看分支上的递交情况:
进入项目根目录,执行 git show-branch
git show-branch
如图:
版权声明:本文为wudinaniya原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。