Re: Git branch bug
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- May 5, 2007, 17:05 UTC
- Message-ID
- <Pine.LNX.4.64.0705051253380.28708@iabervon.org>
- In-Reply-To
- <Pine.LNX.4.64.0705051841200.4015@racer.site>
On Sat, 5 May 2007, Johannes Schindelin wrote:
Show 16 quoted lines
> 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.
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*