新しいGitリポジトリを作成します。
| オプション | 説明 |
|---|---|
| --bare | 作業ディレクトリなしのベアリポジトリを作成 |
| --template=<テンプレートディレクトリ> | 指定したテンプレートディレクトリからテンプレートを使用 |
例:
git init - カレントディレクトリに新しいGitリポジトリを作成git init my_project - 指定したディレクトリに新しいGitリポジトリを作成git init --bare remote_repo.git - ベアリポジトリを作成(サーバー用)
既存のリポジトリをローカルにコピーします。
| オプション | 説明 |
|---|---|
| --branch, -b <ブランチ名> | 指定したブランチをチェックアウト |
| --depth <深さ> | 指定した深さの浅いクローンを作成 |
| --recursive | サブモジュールも含めて再帰的にクローン |
例:
git clone https://github.com/username/repository.git - リモートリポジトリをクローンgit clone https://github.com/username/repository.git my_folder - 指定したフォルダにクローンgit clone --branch develop https://github.com/username/repository.git - 特定のブランチをクローンgit clone --depth 1 https://github.com/username/repository.git - 最新のコミットのみをクローン(履歴なし)