git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git branch bug

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 5, 2007, 17:54 UTC
Message-ID
<Pine.LNX.4.64.0705051954130.4015@racer.site>
In-Reply-To
<Pine.LNX.4.64.0705051942550.14963@bianca.dialin.t-online.de>
Hi,
On Sat, 5 May 2007, Guido Ostkamp wrote:
Show 18 quoted lines
> > 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.
> 
> 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

Previous: Guido Ostkamp
Message 7 of 7 in “Git branch bug”
  1. Guido OstkampMay 5, 2007
  2. Johannes SchindelinMay 5, 2007
  3. Daniel BarkalowMay 5, 2007
  4. Junio C HamanoMay 6, 2007
  5. Daniel BarkalowMay 6, 2007
  6. Guido OstkampMay 5, 2007
  7. Johannes SchindelinMay 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.