git clone hogehoge
の後に,
git branch -a
でリモートにあるブランチを探して
git checkout -b newLocalBranch origin/remoteBranch
とかすればよろし
参考. remote に branch を push し、remote から clone したリポジトリの branch を変更して push する - basyura’s blog
リモートから clone してリポジトリを作り直す。
$ git clone git@github.com:basyura/sandbox.git Initialized empty Git repository in /repos/sandbox/.git/ remote: Counting objects: 5, done. remote: Compressing objects: 100% (3/3), done. remote: Total 5 (delta 0), reused 0 (delta 0) Receiving objects: 100% (5/5), done.ブランチを確認する。master しか見えない。
$ cd sandbox $ git branch * master全てのブランチを確認する。beta ブランチが見える。
$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/beta remotes/origin/masterブランチを切り替える
$ git checkout -b beta origin/beta Branch beta set up to track remote branch beta from origin. Switched to a new branch 'beta'ブランチを確認する。beta ブランチが見える
$ git branch * beta master全てのブランチを確認する。
$ git branch -a * beta master remotes/origin/HEAD -> origin/master remotes/origin/beta remotes/origin/master