Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You are on a branch yet to be born

Tags:

git

Im have strange problem:

$ cd ~/htdocs  $ mkdir test  $ cd test  $ git init Initialized empty Git repository in /home/deep/htdocs/test/.git/  $ git checkout master error: pathspec 'master' did not match any file(s) known to git.  $ git checkout -b master fatal: You are on a branch yet to be born  $ git checkout origin/master error: pathspec 'origin/master' did not match any file(s) known to git.  $ git branch -a (empty this) 

But this is new local empty repo. Where is master branch?

like image 516
Deep Avatar asked Jun 02 '14 19:06

Deep


People also ask

What does creating a branch mean?

Branching means you diverge from the main line of development and continue to do work without messing with that main line. In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.

What does git branch command do?

The git branch command is actually something of a branch management tool. It can list the branches you have, create a new branch, delete branches and rename branches. Most of Git Branching is dedicated to the branch command and it's used throughout the entire chapter.


1 Answers

As ever, Git is right, it just has a quirky way of saying it: when you create a repository, the master branch actually doesn't exist yet because there's nothing for it to point to.

Have you tried committing something after your git init? Adding a remote and pulling from it will also work, of course.

like image 154
Wander Nauta Avatar answered Sep 17 '22 14:09

Wander Nauta