search

Home  >  Q&A  >  body text

How to update all local branches with git?

I thought

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

Just update all branches. I just read the manual and it turns out that this --all updates this branch from all remote repositories.

I have develop, master, feature-xxx locally and these branches are all associated with the remote warehouse.
What should I do if I want to fetch or pull download all branches from the server at once?

过去多啦不再A梦过去多啦不再A梦2793 days ago1008

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