33. Remote branches

Goals

  • Learn about local and remote branches.

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

Run

git branch

Result

$ git branch
* main

As we can see only the main 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
* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/style
  remotes/origin/main

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.