本地克隆未知的 Git 分支
我有一个有两个分支的 git 存储库。如果我克隆我的存储库,我只能看到主分支。我的两个分支都是最新的。问题是我不完全理解合并和分支。该死的!
我的示例可以在这里看到:
http://github.com/rimian/rimian/network
谁能告诉我如何让它恢复正常?
I have a git repository with two branches. If I clone my repo I can only see the master branch. I have both branches up to date. The problem is I don't fully understand merging and branching. Darn it!
My example can be seen here:
http://github.com/rimian/rimian/network
Can anyone tell me how to get this back to normal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的克隆存储库中有两个分支,但它们分别称为
origin/master
和origin/ui
。默认情况下,它还会创建一个名为master
的本地分支,用于跟踪origin/master
,这就是您在执行gitbranch
时看到的内容> 例如。您可以使用命令 gitbranch -r 来查看所有远程分支。您可以创建一个新的本地分支来跟踪远程分支,然后切换到该分支,例如使用 git checkout -tb ui origin/ui 。You have both branches in your cloned repository, but they are called
origin/master
andorigin/ui
. By default, it will also have created a local branch calledmaster
that tracksorigin/master
, and this is what you see when you dogit branch
for example. You can see all remote branches with the commandgit branch -r
. You can create a new local branch that tracks the remote one, and switch to it, for example withgit checkout -tb ui origin/ui
.当我运行
gitk 时,会显示一个 ui 分支和一个 master 分支。例如,我可以运行
To get the uibranch的内容到master中并更新github上的master。
请注意,我在克隆时没有使用您发布的网址。我建议您阅读这个关于分支/合并的 github 指南
When I run
gitk shows me an ui branch and a master branch. I could for instance run
To get the contents of the ui branch into master and update master on github.
Please note that I did not use the url you posted when cloning. I recommend you read this github guide on branching/merging