Hello,
I would like to report the following bug:
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git branch experimental
fatal: Not a valid object name: 'master'.
So, it seems it is not possible to create a named branch on an empty
repository.
I'm not subscribed to the list, so please keep me directly on CC for any
reply, thanks.
Regards
Guido
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:08
Hi,
On Sat, 5 May 2007, Guido Ostkamp wrote:
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git branch experimental
fatal: Not a valid object name: 'master'.
So, it seems it is not possible to create a named branch on an empty
repository.
Actually, it is not possible to branch from a non-existing branch. So,
this is somewhat expected from my POV.
Ciao,
Dscho
From: Daniel Barkalow <hidden> Date: 2016-06-15 22:43:08
On Sat, 5 May 2007, Johannes Schindelin wrote:
Hi,
On Sat, 5 May 2007, Guido Ostkamp wrote:
quoted
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git branch experimental
fatal: Not a valid object name: 'master'.
So, it seems it is not possible to create a named branch on an empty
repository.
Actually, it is not possible to branch from a non-existing branch. So,
this is somewhat expected from my POV.
This leaves open the question of how you make your initial commit in a
branch that isn't master. I think the answer should be:
$ git checkout -b experimental
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of HEAD.
fatal: just how do you expect me to merge 0 trees?
Which should probably be:
$ git checkout -b experimental
warning: You appear to be on a branch yet to be born.
warning: Putting you on a new branch yet to be born.
And leaving .git/HEAD pointing to refs/heads/experimental instead of
refs/heads/master, with refs/heads/ still empty.
$ git branch experimental
Should probably give a more informative error message, but branches with
no commits that aren't the current branch has no existance at all, so it
can't work to create them without switching to them.
-Daniel
*This .sig left intentionally blank*
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git branch experimental
fatal: Not a valid object name: 'master'.
So, it seems it is not possible to create a named branch on an empty
repository.
Actually, it is not possible to branch from a non-existing branch. So,
this is somewhat expected from my POV.
From a git beginners point of view, I would expect that the 'master'
branch is automatically created when performing the 'git init'. Why is
this not the case?
Regards
Guido
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:08
Hi,
On Sat, 5 May 2007, Guido Ostkamp wrote:
quoted
On Sat, 5 May 2007, Guido Ostkamp wrote:
quoted
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in .git/
$ git branch experimental
fatal: Not a valid object name: 'master'.
So, it seems it is not possible to create a named branch on an empty
repository.
Actually, it is not possible to branch from a non-existing branch. So,
this is somewhat expected from my POV.
From a git beginners point of view, I would expect that the 'master'
branch is automatically created when performing the 'git init'. Why is
this not the case?
Well, one side of the branch _is_ created. But you have to provide initial
content, to make it a proper branch, from which you can actually branch
off.
Having said that, and having read Daniels mail, I agree that this
behaviour should be changed, along with the behaviour of "git checkout -b
<branch>" in a fresh repo.
It might be the illogical thing, to allow branching of a
yet-to-be-initialised branch, but it does not hurt either.
Ciao,
Dscho