1.查看远程分支
1 |
git branch -a |
$ git branch -a
* master
remotes/origin/longhua
remotes/origin/master
remotes/origin/quantian
remotes/origin/release
remotes/origin/release_2022-03-28
remotes/origin/workorder
运行等到下面这些分支
我们现在在分支master 下。
2. 查看本地分支
1 |
$ git branch |
* master
本地分支只有master
3. 切分支
1 |
git checkout -b workorder |
Switched to a new branch 'workorder'
已经切换到了 workorder分支运行 git branch 看下本地分支,我们在分支workorder上。
1 |
git branch master * workorder |
4.切换回master分支
1 |
$ git checkout master |
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
切换回来了。
5. 拉取分支代码
1 |
git pull origin workorder |