Git init did not create branch master

Asked

Viewed 694 times

2

I’m trying to give a git init in my project, it returns successfully:

Initialized empty Git repository in C:/myprojetPath/.git/

But because when I type git branch, it returns no branch?

$ git branch

(Não retorna nenhum branch)
myuser@WKS054 MINGW64 myprojetPath (master)
$

But on my terminal (Git bash, actually) it shows that I’m on the master branch.

But when I switch branches, I can’t get back to the master branch with git checkout master, it informs that the branch does not exist

1 answer

1


It seems that when you have just created a repository it is common.

I did some tests here and only the branch appears when I did the following:

git init
touch um_arquivo_incial
git add um_arquivo_inicial
git commit -am "Primeiro commit"

Then if you do git branch, then you’ll see:

 >*master
  • I think that’s right, I gave the first commit, now this all normal! thank you very much

Browser other questions tagged

You are not signed in. Login or sign up in order to post.