9

git 一次性拉取所有分支并缓存到本地

 8 months ago
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.
neoserver,ios ssh client

git 一次性拉取所有分支并缓存到本地

2023-12-06     tech git
git.jpg
#!/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 "批量创建分支完成。"

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK