9
git 一次性拉取所有分支并缓存到本地
source link: https://blog.kelu.org/tech/2023/12/06/git-checkout-all-branch-from-remote-to-local.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#!/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 "批量创建分支完成。"
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK