After Git clone from GitHub, I do not see my branch

后端 未结 3 1372
眼角桃花
眼角桃花 2021-01-29 21:28

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 i

3条回答
  •  清歌不尽
    2021-01-29 21:51

    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  origin/
    

    That'll create a new local branch using the remote's branch as the starting point.

提交回复
热议问题