mpoisot mpoisot - 8 months ago 52
Git Question

Can "git pull --all" update all my local branches?

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

Updating all my local branches is tedious:

git fetch --all
git rebase origin/master
git co staging
git rebase origin/staging
git co production
git rebase origin/production

I'd love to be able to just do a "git pull -all", but I haven't been able to get it to work. It seems to do a "fetch --all", then updates (fast forward or merges) the current working branch, but not the other local branches.

I'm still stuck manually switching to each local branch and updating.


git-up automates this. From the README:

So git pull merges by default, when it should really rebase. You can ask it to rebase automatically instead, but it still won't touch anything other than the currently checked-out branch. If you're tracking a bunch of remote branches, you'll get non-fast-forward complaints next time you push.

Solve it once and for all:

gem install git-up