I have a master
and a development
branch, both pushed to GitHub. I\'ve clone
d, pull
ed, and fetch
ed, but I re
Here is another short one-liner command which creates local branches for all remote branches:
(git branch -r | sed -n '/->/!s#^ origin/##p' && echo master) | xargs -L1 git checkout
It works also properly if tracking local branches are already created.
You can call it after the first git clone
or any time later.
If you do not need to have master
branch checked out after cloning, use
git branch -r | sed -n '/->/!s#^ origin/##p'| xargs -L1 git checkout