Why does my ‘git branch’ have no master?

Most Git repositories use master as the main (and default) branch – if you initialize a new Git repo via git init, it will have master checked out by default.

However, if you clone a repository, the default branch you have is whatever the remote’s HEAD points to (HEAD is actually a symbolic ref that points to a branch name). So if the repository you cloned had a HEAD pointed to, say, foo, then your clone will just have a foo branch.

The remote you cloned from might still have a master branch (you could check with git ls-remote origin master), but you wouldn’t have created a local version of that branch by default, because git clone only checks out the remote’s HEAD.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)