an assorted collection of randomness and non-essential remarks
Have at least one original repos where PHP is the dominant language The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos Fork and commit to someone's open source project in need Have a project valued enough to be forked by someone else Have at least three original repos where Ruby is the dominant language Have at least one original repo where Ruby is the dominant language Have at least one original repo where some form of shell script is the dominant language
Endorse tarakanbg on Coderwall Powered by Obtvse

Cloning Remote Branches With Git

After cloning locally a remote git project with multiple branches, you will only get the default project branch, typically master. At this point executing git branch will show you the locally available branches in your repository:

    $ git branch
    * master

However if you add the -a option to git branch you’ll get a list, which also includes all the available remote branches, like this:

    $ git branch -a
    * master

Using this list as a reference, we can now create a local tracking branch to work on, for example:

    git checkout -b source origin/source

The source branch will now be checked out and available locally, which we can see by running git branch once again:

    $ git branch
    * source

That’s it! There’s also the git pull --all command which will fetch all the remote branches that have been tracked locally, however it will not create local tracking branches. There is no git native way of automatically creating local tacking branches of all remotes and this is perhaps not a good idea anyway, as they can get stale rather quick.

Back to Blog