takafumi blog

日々の勉強メモ

Git運用 その2 / リモートのリポジトリを一発でcheckout

環境   git version 1.8.3.1

リモートにあるリポジトリを一発でローカルに持ってくる方法。

例えば

$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/feature/sample1
  remotes/origin/feature/sample2

のときremotes/origin/feature/sample1をcheckoutしたい場合は

$ git checkout -b feature/sample1 remotes/origin/feature/sample1

とすれば、リモートリポジトリをローカルに作成できる。

git checkout -b <ローカルリポジトリ名> <リモートリポジトリ名>

である。


takafumi-s.hatenablog.com