Creating branch off of remote master

Pretty much only pull and fetch retrieve new commits and update remote remote refs. Other operations only work on your local copy. When you create a branch, it is created off the specified ref, but that ref is looked up in the local repository only. You can see what this ref currently is for each remote branch under .git/refs/remotes/origin.

I would presume the goal behind this design is to allow completely disconnected operation. If checkout -b were to attempt to base the new branch on the remote ref in the remote repository, the remote repository would have to be contacted. By storing the ref locally, the branch can still be created even when completely disconnected.


What you explained makes sense, but all I can say is this is how Git is!

To update your 'remote' branch on server you need to talk to server atleast once. (Git pull does that).

Unless you did a git-pull your local repo did not know of the branch your friend had created. When you did a git-pull, it updated your local master(origin/master) also.

Hope this makes sense!

Tags:

Branch

Git

Master