rip off from
(1) Inside git local repostitory, create a new sh file
touch getAllBranches.sh
vi getAllBranches.sh
(2) Insert the below content to getAllBranches.sh file:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
(3) Get all branches:
chmod +x getAllBranches.sh
sh getAllBranches.sh
(4) Check result at local repository:
git branch