Note that Git said:
Switched to a new branch 'staging'
(emphasis mine). The branch staging
did not exist until you asked Git to check it out. Git tried to check it out, which failed—so then it tried to create it, and that worked. This is a special operation built in to git checkout
: if you ask to check out a branch by name, and the name does not correspond to any existing branch, Git will see if there's one so-called remote-tracking branch with a "close enough" name.
To list these remote-tracking branches, use:
git branch --list --remotes
or abbreviate this as git branch -lr
. If you have origin/zerblatt
, you can create your own zerblatt
by running git checkout zerblatt
. If you don't have that, git checkout
will just complain that zerblatt
is not a branch or a path that it understands.
In a comment, you asked:
is [this] because the clone operation didn't pull the staging branch, but only the master branch?
Watch out for Git's peculiar terminology: you don't "pull" a branch by cloning. The word pull
means the git pull
command, which I suggest you avoid: it's meant as a convenience shortcut, but it will do things you won't want it to.
The clone
command clones everything by default, but it makes, for you, your own private repository, separate from the other Git repository. That other Git repository has its own branches, which are now different from your branches. To keep them separate for you, your Git renames all their branches: their master
becomes your origin/master
, and their staging
becomes your origin/staging
.
These origin/*
names are (your, not their) remote-tracking branches, and correspond to their (regular or local) branches. Your own local branches are yours to do with as you like, but initially, Git just creates one, normally master
.
The really tricky thing here is what a branch actually means and is. You may wish to read What exactly do we mean by "branch"? (save this for later, if you're very new to Git). There are several different things that Git uses that are all loosely called "branch"; and while they are all related, they are not the same.