- 本地建立一个空文件夹,然后git clone 远程地址,可以拉取远程master的所有项目至本地
- git branch 用来查看分支信息,git branch -a查看所有分支(包括远程remote)
$ git branch
* master
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/Isaac
remotes/origin/align
remotes/origin/color_transfer
remotes/origin/dev_Br20190103
remotes/origin/dev_yx
*表示当前所在的分支,remotes表示远程分支
另外,还可以通过 git status查看当前所有分支
$ git status
On branch size_expand
nothing to commit, working tree clean
一、git创建本地分支
$ git checkout -b 本地分支名
表示创建本地分支并切换到新建分支,等价于以下两行:
1.创建本地分支:git branch 本地分支名
2.切换到新建的分支:git checkout 本地分支名
使用git branch看到已经切换到新建的本地分支了:
$ git branch
master
* size_expand
若发现git branch之后内容为空,则需要将需要git的文件内容添加至仓库