40. Remote branches

Goals

  • To learn about local and remote branches

Let’s take a look at the branches in our cloned repository.

Run:

git branch

Result:

$ git branch
* master

As we can see only the master branch is listed in it. Where is the style branch? git branch only lists the local branches by default.

01 01 List of the remote branches

To see all the branches, try the following command:

Run:

git branch -a

Result:

$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/style
  remotes/origin/master

Git lists all the branches from the original repo, but the remote repository branches are not treated as local ones. If we need our own style branch, we need to create it on our own. In a minute you will see how it is done.