Git拉取远程分支到本地

Git拉取远程分支到本地

拉取分支

首先你得先查看你是否和远端的仓库创建链接。html

git remote -v
复制代码

若是没有的话那就自行添加一下git

git remote add origin  xxxx(你远程分支的git仓库地址)
复制代码

若是天天要提交代码 ,能够绕过上面这一步,直接切换分支github

git checkout -b Q3 origin/Q3
复制代码

这个时候操做失败提示以下:bash

  • fatal: 'origin/Q3' is not a commit and a branch 'Q3' cannot be created from it 表明你本地没有Q3这个远程分支。

能够执行 git branch -r 来检查本地是否有Q3远程分支。 拉取远程分支到本地并切换分支。fetch

git fetch origin Q3
git checkout -b Q3 origin/Q3
复制代码

拉取远程分支到本地spa

git pull origin Q3
复制代码

个人博客和github,喜欢就去点点星吧,谢谢。

github.com/lanpangzhicode

blog.langpz.comhtm

参考

curder.gitbooks.io/blog/git/re…blog

相关文章
相关标签/搜索