#!/bin/bash REMOTE_NAME="origin" REMOTE_BRANCHES=$(git ls-remote --heads $REMOTE_NAME | awk -F/ '{print $3}') for branch in $REMOTE_BRANCHES; do git checkout -b $branch $REMOTE_NAME/$branch git checkout master done echo "批量创建分支完成。"