将远程git仓库里的指定分支拉取到本地(本地不存在的分支)
借鉴自:https://www.cnblogs.com/feipeng8848/p/12033802.html.
https://www.cnblogs.com/hamsterPP/p/6810831.html
新项目创建分支,想从远程仓库里拉取一条本地不存在的分支时:
git checkout -b 本地分支名 origin/远程分支名
这个将会自动创建一个新的本地分支,并与指定的远程分支关联起来。
如果拉去不成功:
fatal: Cannot update paths and switch to branch ‘dev2’ at the same time.
Did you intend to checkout ‘origin/dev2’ which can not be resolved as commit?
我们要先执行:
git fetch
在执行 就好了
git checkout -b 本地分支名 origin/远程分支名