change the branch when the branch not shown in git branch -l

后端 未结 3 1708
南旧
南旧 2021-01-15 08:09

When I cloned a remote repository, I used the following command-

git clone -b mybranch --single-branch git://sub.domain.com/repo.git

After

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 08:38

    git branch -l shows you local branches. You want remote branches, so try git branch -r. When you see the branch you want, you can automatically create and checkout a local branch tracking the given remote branch with git checkout .

    For example, if your git branch -r shows a branch you want called origin/my-feature, just do

    $ git checkout my-feature
    

提交回复
热议问题