metasj
metasj

Reputation: 65

how to Specify master branch by initialising git?

I typed the command from the prompt-

G:\new-git-project>git init

After that the prompt says-

G:\new-git-project\.git\

But it doesn't give indication of the master branch created.The expected result should have been-

(master#)G:\new-git-project\.git\

Where is the error?

Upvotes: 1

Views: 56

Answers (2)

Jonathan.Brink
Jonathan.Brink

Reputation: 25383

Your command prompt is not specifying the master branch because you have only created your repo...it doesn't yet have any commits for a branch to point to.

After your git init you can create an initial empty commit like this:

git commit --allow-empty -m 'Initial commit'

Upvotes: 0

Joseph D.
Joseph D.

Reputation: 12174

You need to clone a git project first. Refer to the tutorial here.

$ git init
$ git clone https://github.com/your/repo.git # Sets master -> origin/master
$ git branch -r # shows origin/master

For newly created/empty repos,

$ git add .
$ git commit -m "commit message"
$ git push -u origin master

Upvotes: 1

Related Questions