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

Re: commit 0? (or: create new empty branch)

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Mar 11, 2008, 13:08 UTC
Message-ID
<47D6843A.1030200@viscovery.net>
In-Reply-To
<20080311123004.GA27577@bit.office.eurotux.com>
Luciano Rocha schrieb:
Show 13 quoted lines
> I'd like to create a new branch, without any pre-existing data, for
> purposes similar to git's html/man/.....
> 
> However, I've been unable to do that using the higher level tools.
> 
> Even starting from an empty git rep, I can't create a branch:
> 
> $ git init
> Initialized empty Git repository in .git/
> $ git branch empty
> fatal: Not a valid object name: 'master'.
> 
> How were the different git.git branches created?
There are two ways:
1. Plumbing level
  $ git symbolic-ref HEAD refs/heads/html
  $ rm .git/index
  ...commit new content...
2. Porcelain level
  $ mkdir ../html && cd ../html
  $ git init
  ...commit new content...
  $ cd -   # go back
  $ git fetch ../html master:html
-- Hannes
Previous: Johannes Schindelin
Message 5 of 5 in “commit 0? (or: create new empty branch)”
  1. Luciano RochaMar 11, 2008
  2. Johannes SchindelinMar 11, 2008
  3. Luciano RochaMar 11, 2008
  4. Johannes SchindelinMar 11, 2008
  5. Johannes SixtMar 11, 2008

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.