* How can I create a commit without a parent?
@ 2010-02-02 8:00 Ron Garret
2010-02-02 8:05 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ron Garret @ 2010-02-02 8:00 UTC (permalink / raw)
To: git
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.
Thanks,
rg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I create a commit without a parent?
2010-02-02 8:00 How can I create a commit without a parent? Ron Garret
@ 2010-02-02 8:05 ` Junio C Hamano
2010-02-02 8:19 ` Ron Garret
2010-02-02 15:02 ` Jakub Narebski
2010-02-02 16:40 ` Jay Soffian
2 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2010-02-02 8:05 UTC (permalink / raw)
To: Ron Garret; +Cc: git
Ron Garret <ron1@flownet.com> writes:
> git commit-tree insists on having at least one parent commit at
> the command line.
Incorrect. "git commit" might but "git commit-tree" does. Perhaps you
are forgetting that the first object name is a tree to be wrapped.
A short answer is that you don't create a root commit twice in a single
repository, period. Your repository _may_ be end up with more than one
root but that typically is due to you fetching unrelated histories from
different repositories, each created its own root.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I create a commit without a parent?
2010-02-02 8:05 ` Junio C Hamano
@ 2010-02-02 8:19 ` Ron Garret
0 siblings, 0 replies; 5+ messages in thread
From: Ron Garret @ 2010-02-02 8:19 UTC (permalink / raw)
To: git
In article <7vwryw6p16.fsf@alter.siamese.dyndns.org>,
Junio C Hamano <gitster@pobox.com> wrote:
> Ron Garret <ron1@flownet.com> writes:
>
> > git commit-tree insists on having at least one parent commit at
> > the command line.
>
> Incorrect. "git commit" might but "git commit-tree" does. Perhaps you
> are forgetting that the first object name is a tree to be wrapped.
No, I didn't forget that. I forgot to omit the -p flag. Doh!
> A short answer is that you don't create a root commit twice in a single
> repository, period.
Why not? I could easily create an empty root commit and multiple
branches off that. (Maybe that's a better way to go.) What would be
the difference?
rg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I create a commit without a parent?
2010-02-02 8:00 How can I create a commit without a parent? Ron Garret
2010-02-02 8:05 ` Junio C Hamano
@ 2010-02-02 15:02 ` Jakub Narebski
2010-02-02 16:40 ` Jay Soffian
2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2010-02-02 15:02 UTC (permalink / raw)
To: Ron Garret; +Cc: git
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How can I create a commit without a parent?
2010-02-02 8:00 How can I create a commit without a parent? Ron Garret
2010-02-02 8:05 ` Junio C Hamano
2010-02-02 15:02 ` Jakub Narebski
@ 2010-02-02 16:40 ` Jay Soffian
2 siblings, 0 replies; 5+ messages in thread
From: Jay Soffian @ 2010-02-02 16:40 UTC (permalink / raw)
To: Ron Garret; +Cc: git
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-02 16:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 8:00 How can I create a commit without a parent? Ron Garret
2010-02-02 8:05 ` Junio C Hamano
2010-02-02 8:19 ` Ron Garret
2010-02-02 15:02 ` Jakub Narebski
2010-02-02 16:40 ` Jay Soffian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).