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

Re: How can I create a commit without a parent?

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 2, 2010, 16:40 UTC
Message-ID
<76718491002020840y16d62fb5qc4f6c51602dac94f@mail.gmail.com>
In-Reply-To
<ron1-5383E3.00002602022010@news.gmane.org>
On Tue, Feb 2, 2010 at 3:00 AM, Ron Garret <ron1@flownet.com> wrote:
> SLSIA.  git commit-tree insists on having at least one parent commit at
> the command line.  From reverse-engineering it seems like I could do it
> by setting .git/HEAD to 'ref: refs/heads/some-nonexistent-branch' but
> mucking with HEAD directly like that feels kinda scary.

I guess you're looking to do it with plumbing, but with porcelain the way I'd do it is:

$ git init foo $ git init bar $ cd bar $ git commit --allow-empty -m "empty bar root commit" $ cd ../foo $ git commit --allow-empty -m "empty foo root commit" $ git fetch ../bar master:bar

j.
Previous: Jakub Narebski
Message 5 of 5 in “How can I create a commit without a parent?”
  1. Ron GarretFeb 2, 2010
  2. Junio C HamanoFeb 2, 2010
  3. Ron GarretFeb 2, 2010
  4. Jakub NarebskiFeb 2, 2010
  5. Jay SoffianFeb 2, 2010

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.