LoginSignup
1
2

More than 3 years have passed since last update.

git cloneしてローカルにファイルを落としたが、該当のブランチが見当たらない

Last updated at Posted at 2019-12-02

はじめに

下記のような複数既にブランチが存在するGitHubレポジトリにおいて、ローカルにgit cloneしたとします。
スクリーンショット 2019-12-02 13.04.37.png

例えば上記ブランチのfeature/initialSetupに切り替えたいとしてgit branchしてみると、developブランチしか見当たりません。

$ git branch
* develop

このような場合の対処法を記します。

コマンド

git branch-aをつけて、remotes側(GitHub側)に隠れているブランチを確認します。

$ git branch -a
* develop
  remotes/origin/HEAD -> origin/develop
  remotes/origin/develop
  remotes/origin/feature/initalSetup
  remotes/origin/feature/locale
  remotes/origin/feature/navigation
  remotes/origin/feature/setup-collection
  remotes/origin/feature/setup_navigation
  remotes/origin/feature/view
  remotes/origin/feature/view_passwordRecovery
  remotes/origin/firebase_auth
  remotes/origin/master

その後、切り替えたいブランチを指定します。
例:feature/initialSetupに切り替え

$ git checkout feature/initalSetup
Branch 'feature/initalSetup' set up to track remote branch 'feature/initalSetup' from 'origin'.
Switched to a new branch 'feature/initalSetup'
$ git branch
  develop
* feature/initalSetup
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2