git clone
指令預設只會 clone master branch,如果想要 clone remote repository 的所有 branches,可以在進入本地 repository 資料夾後,執行以下命令:
#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `;
do git branch --track ${branch#remotes/origin/} $branch;
done
執行後可以使用 git branch
指令確認是否成功