search

Home  >  Q&A  >  body text

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

原来以为

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

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

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

过去多啦不再A梦过去多啦不再A梦2761 days ago987

reply all(2)I'll reply

  • 阿神

    阿神2017-05-02 09:38:43

    I wrote a script myself. Contribute.

    git branch | awk 'BEGIN{print "echo ****Update all local branch...@daimon***"}{if(=="*"){current=substr(rrreee,3)};print a"git checkout "substr(rrreee,3);print "git pull --all";}END{print "git checkout " current}' |sh

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:38:43

    For details, please see:

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

    There should be no native solution, or Git itself does not have such a function?

    reply
    0
  • Cancelreply