首页 > git怎么更新本地所有分支?

git怎么更新本地所有分支?

原来以为

git pull --all
# 或
git fetch --all

就是更新所有分支。刚看了手册,原来这个--all是从所有远程仓库更新这一个分支。

我本地有develop,master, feature-xxx这些分支都与远程仓库关联起来了。
我要是想一次性把所有分支全部从服务器上fetch或者pull下来,应该怎么办呢?


详情参见:

Can “git pull --all” update all my local branches?

应该是没有原生的解决方案吧,或者说Git本身并没有这样的功能?


自己写了个脚本。贡献下吧。

git branch | awk 'BEGIN{print "echo ****Update all local branch...@daimon***"}{if($1=="*"){current=substr($0,3)};print a"git checkout "substr($0,3);print "git pull --all";}END{print "git checkout " current}' |sh
【热门文章】
【热门文章】