Re: How can I create a commit without a parent?
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Feb 2, 2010, 15:02 UTC
- Message-ID
- <m3zl3radgl.fsf@localhost.localdomain>
- In-Reply-To
- <ron1-5383E3.00002602022010@news.gmane.org>
Ron Garret <ron1@flownet.com> writes:
> 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.
You have git-symbolic-ref to set HEAD directly (don't forget to remove index).
Or you can set up / initialize separate (new) repository, create commit there and then pull this new repository into current one.
P.S. Creating new root (parentless) commit isn't something that you do on purpose, usually.
-- Jakub Narebski Poland ShadeHawk on #git