I have a repository on Github with 2 branches: master
and develop
.
When I clone the repository and run $ git branch
it shows only
To put it simply, git clone repository-url
does the following things, in order:
Creates a new empty repository.
git init
Creates a remote called "origin" and sets it to the given url.
git remote add origin repository-url
Fetches all commits and remote branches from the remote called "origin".
git fetch --all
Creates a local branch "master" to track the remote branch "origin/master".
git checkout --track origin/master
An interesting point is that a fork (in GitHub or Bitbucket) is just a server side clone.