Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git init doesn't create master branch

Tags:

git

I seem to have a problem with the git not initializing the master branch when creating a new local repository. When I run "git init", the master branch doesn't seem to be created. Here's the copy-paste from my command line

C:\Users\KJA\workspace\gitproblem>git init
Initialized empty Git repository in C:/Users/KJA/workspace/gitproblem/.git/

C:\Users\KJA\workspace\gitproblem>git branch

C:\Users\KJA\workspace\gitproblem>git branch mybranch
fatal: Not a valid object name: 'master'.

C:\Users\KJA\workspace\gitproblem>

Is there a bug in the newest version of git for windows or something?

like image 223
Kamil Janowski Avatar asked Feb 26 '16 15:02

Kamil Janowski


1 Answers

Git init creates a repo without any commits.

Since a branch is a pointer to a commit, you can't have branches until you commit something.

like image 176
SLaks Avatar answered Oct 12 '22 14:10

SLaks