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

前端 未结 25 2400
失恋的感觉
失恋的感觉 2020-11-22 16:33

I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.

Updating all my local branches is

25条回答
  •  轮回少年
    2020-11-22 17:21

    It's not so hard to automate:

    #!/bin/sh
    # Usage: fetchall.sh branch ...
    
    set -x
    git fetch --all
    for branch in "$@"; do
        git checkout "$branch"      || exit 1
        git rebase "origin/$branch" || exit 1
    done
    

提交回复
热议问题