Track all remote git branches as local branches

The answer given by Otto is good, but all the created branches will have “origin/” as the start of the name. If you just want the last part (after the last /) to be your resulting branch names, use this:

for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done

It also has the benefit of not giving you any warnings about ambiguous refs.

Leave a Comment