在git克隆后,我没有看到我的分支 [英] After git clone, I do not see my branch
问题描述
我在Github上有一个仓库。它包含主和一个分支。
当我克隆它时,我只获得主人,并没有看到我的分支。
为什么会这样?如何在库中查看所有分支?
默认情况下, git clone
只创建一个分支:当前签出的分支,一般是主分支。但是,它确实为远程中的所有其他分支创建了远程跟踪分支。把它们当作远程分支的本地拷贝,可以通过提取来更新。他们不是真正的本地分支机构,因为他们只是作为指向远程分支机构的指针,而不是为了您的工作。
如果您运行 git branch -a
,您将看到所有分支,本地和远程。如果你只想看到远程的,使用 git branch -r
。如果您更喜欢视觉历史显示,请尝试 gitk --all
(或 gitk --remotes
)。
要创建一个本地分支,请使用
git分支<分行名称>起源/<分支名称>
这将使用远程分支作为起点创建一个新的本地分支。
I have a repository on Github. It contains master and one branch.
When I clone it, I obtain only master and do not see my branch.
Why is it so? How can I see all branches in the repository?
By default, git clone
creates only one branch: the currently checked out one, generally master. However, it does create remote tracking branches for all other branches in the remote. Think of these as local copies of the remote's branches, which can be updated by fetching. They're not real local branches, as they're intended only as pointers to where the remote's branches are, not for you to work on.
If you run git branch -a
you'll see all branches, local and remote. If you want to see just the remote ones, use git branch -r
. If you prefer a visual history display, try gitk --all
(or gitk --remotes
).
To create a local branch to work on, use
git branch <branch-name> origin/<branch-name>
That'll create a new local branch using the remote's branch as the starting point.
这篇关于在git克隆后,我没有看到我的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!