Git 教程:了解 git pull 和分支(使用特定的示例存储库)
背景:
假设我有以下 Git URL(托管在 github 上),
http://github.com/mikl/drupal.git
git://github.com/mikl/drupal.git (Git read-only)
我有兴趣拥有此存储库的本地副本,这样我就可以练习使用 git 中的分支并查看本地工作树如何更改取决于我在哪个分支机构工作。
问题:
- 首先,我设置了一个本地目录并执行 git clone git://github.com/mikl/drupal.git ...这会克隆全部的分支机构?还是只会克隆大师?
- github 的 Web 前端为我提供了一个“下拉”菜单,允许我切换分支...更改此下拉菜单实际上会更改我运行 git clone 时将抓取的分支吗?
- 如果我想在本地计算机上创建此存储库的新副本,但我只对该存储库的两个分支感兴趣,并且想忽略其余所有分支,那么我应该使用什么命令来确保只克隆这两个分支而不克隆其他分支(假设其中一个分支是主分支)?
Backround:
Suppose I have the following Git URLs (hosted on github)
http://github.com/mikl/drupal.git
git://github.com/mikl/drupal.git (Git read-only)
I am interested in having a local copy of this repository so I can pratice working with branches in git and see how my local working tree can change depending on which branch I am working with.
Questions:
- To get started, I set up a local directory and do git clone git://github.com/mikl/drupal.git ... Will this clone all of the branches? Or will it only clone master?
- The web front-end for github gives me a "drop down" menu that allows me to switch branches ... Does changing this drop-down actually change which branch I will be grabbing when I run git clone?
- If I want a new copy of this repository on my local machine, but I am interested in only two branches of this repository and I want to ignore all the rest, what command do I use to ensure I clone only those two branches and nothing else (assume one of the branches is master)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git branch -r
and create a local tracking branch withgit branch localname origin/remotename