本地获取远端分支,并切换到此分支
从远程仓库中拉一个本地不存在的分支:
git checkout -b 本地分支名 origin/远程分支名
- 第一步 git fetch 先拉取遠端所有分支
- 第二步 git checkout -b dev origin/dev 切換到遠端分支
如果出现提示: cannot update paths and switch to branch xx at the same time. Did you intend to checkout origin/xx which can not be resolved as commit?
需要先git fetch