Try   HackMD

使用 Git Clone Remote Repository 的所有 Branch

操作說明

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 指令確認是否成功


參考資料

Git clone all remote branches locally.