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

前端 未结 25 2419
失恋的感觉
失恋的感觉 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:27

    I came across the same issue of this question...

    Wondering myself about it, I did a small alias function inside my .bashrc file:

    gitPullAll() {
        for branch in `git branch | sed -E 's/^\*/ /' | awk '{print $1}'`; do
            git checkout $branch
            git pull -p
            printf "\n"
        done
        echo "Done"
    }
    

    Worked for me (:

提交回复
热议问题