拉取某项目下所有git分支并批量推送

拉取某项目下所有git分支并批量推送

git clone master分支链接
cd 项目目录

# 拉取所有分支
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all 

# 推送所有分支
git remote remove origin  # 删除远程仓库
git remote -v  # 查看远程关联仓库
git remote add origin http://gitlab.xxx.cn/用户名/项目名.git
git push --mirror 

猜你喜欢

转载自blog.csdn.net/SweetHeartHuaZai/article/details/130602943