mpoisot mpoisot - 1 year ago 90
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download