Git-克隆仓库后我的分支没有显示 [英] Git - My branches are not showing after cloning a repo
问题描述
我了解(到目前为止),当我克隆一个仓库时,我并没有真正克隆它,我只是放下了母版-这是它的工作原理,对吗?
I understand (as of just now) that when I clone a repo, I don't really clone it, I just bring the master down - this is how it works, right?
所以我需要通过跟踪检出远程分支,这很好,但是如何查看远程分支以了解可以检出什么?
So I need to checkout a remote branch with tracking, that's fine, but how do I see the remote branches to know what I can checkout?
更新
所以事实证明,我应该使用 git branch -a
或 -r
在本地查看它们,但我没有.因此,我的问题仍然存在,如果我所有的分支都已被推到远程,我如何看待它们?他们在哪里?
So it turns out I should see them locally using git branch -a
or -r
but I don't. So my question remains, if all my branches have been pushed to remote, how do I see them? Where are they?
卢克
推荐答案
我了解(到目前为止),当我克隆一个仓库时,我并没有真正克隆它,我只是降低了主设备-这是它的工作原理,对吧?
I understand (as of just now) that when I clone a repo, I don't really clone it, I just bring the master down - this is how it works, right?
不.当您克隆一个仓库时,您确实可以克隆它.之后,您拥有与该回购相关的所有信息.
No. When you clone a repo, you really do clone it. You have everything related to that repo after that.
使用命令 git branch -r
列出远程分支.
Use the command git branch -r
to list remote branches.
我想进一步说明一下.这里的远程分支"一词可能会引起误解.这些分支不是完全远程的,它们是本地的,但是它们代表您上次执行git fetch(或拉取)时远程分支的状态.我希望这可以为您解决问题.
Thought I could elaborate a bit more. The term "remote branch" might be a bit misleading here. Those branches are not exactly remote, they are local, but they represent the state of the remote branch when you last time did a git fetch (or pull). I hope this might clear things up for you a bit.
这篇关于Git-克隆仓库后我的分支没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!