Last Updated: February 25, 2016
·
8.967K
· diegoponciano

How to git clone (track and fetch) all remote branches

This following script will loop for all remote branches, create one with the same name locally, track it to the remote, and then fetch/pull all of them.

#!/bin/bash
for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done
git fetch --all
git pull --all