Git拉取远程分支到本地

Git拉取远程分支到本地

拉取分支

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

git remote -v

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

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

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

git checkout -b Q3 origin/Q3

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

  • fatal: 'origin/Q3' is not a commit and a branch 'Q3' cannot be created from it

表明你本地没有Q3这个远程分支。code

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

git fetch origin Q3
git checkout -b Q3 origin/Q3

拉取远程分支到本地blog

git pull origin Q3

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

https://github.com/lanpangzhirem

http://blog.langpz.comget

参考

https://curder.gitbooks.io/blog/git/remote_repository_pull.html博客

相关文章
相关标签/搜索