I’d like to know how to clone automatically all remote branches in my local repository without execute one command for each one like this:
git checkout -b <branch> <remote>/<branch>
There are a lot of branches, too many to do one command for each one.
I’d recommend create an alias (showed below), which executes ‘checkout’ for every remote branches. OBS: Each local branch’s name in your local repository will be the same as in the remote.
git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'
After you create the alias, just execute like this: