This Bash script helped me out:
#!/bin/bash
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
git branch --track "${branch##*/}" "$branch"
done
It will create tracking branches for all remote branches, except master (which you probably got from the original clone command). I think you might still need to do a
git fetch --all
git pull --all
to be sure.
One liner:
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
As
As usual: test in your setup before copying rm -rf universe as we know it
Credits for one-liner go to user cfi