threads / discuss / 13358

Parent-less branches

Subject: Parent-less branches

## tl;dr

7 messages between May 2, 2008 and May 3, 2008.

replies: 6people: 5as markdown or json

Pedro Melo· May 2, 2008, 21:05 UTC · lore
Hi,

inside an existing repository I want to create a new branch without a parent commit. Is there a set of commands to do this? Usually only the initial commit of a

The idea is to use that branch to track an external source tarball.  
 From time to time, I would checkout the branch and dump a new  
tarball with fresh source code, commit it to the branch and merge  
again with my master.

I could create the setup this setup if I create a separate repo for each external source tarball and then fetch them into my main repository. But I don't need those repos after that so I'm just wondering if there is a way to create the empty branch directly.

Thanks,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!
Junio C Hamano· May 2, 2008, 21:47 UTC · re: Pedro Melo · lore

Re: Parent-less branches

Pedro Melo <melo@simplicidade.org> writes:
> inside an existing repository I want to create a new branch without a
> parent commit. Is there a set of commands to do this?

Typically these commits come about because you created a completely separate history elsewhere in a separate repository and fetched and/or pulled from there.

So "a set of commands to do this" would be:
	go away
	git init
        build history as usual
	come back
        git fetch ..from that other repository..
Wincent Colaiuta· May 2, 2008, 22:32 UTC · re: Junio C Hamano · lore

Re: Parent-less branches

El 2/5/2008, a las 23:47, Junio C Hamano escribió:
Show 16 quoted lines
> Pedro Melo <melo@simplicidade.org> writes:
>
>> inside an existing repository I want to create a new branch without a
>> parent commit. Is there a set of commands to do this?
>
> Typically these commits come about because you created a completely
> separate history elsewhere in a separate repository and fetched and/or
> pulled from there.
>
> So "a set of commands to do this" would be:
>
> 	go away
> 	git init
>        build history as usual
> 	come back
>        git fetch ..from that other repository..

I wanted to do this just the other day, but I did it all inside the one repo, and made some notes on the process here:

http://rails.wincent.com/wiki/Creating_independent_branches_with_Git
Basically, using "git write-tree" and "git commit-tree" plumbing.

Cheers, Wincent

Pedro Melo· May 2, 2008, 23:04 UTC · re: Wincent Colaiuta · lore

Re: Parent-less branches

Hi,
On May 2, 2008, at 11:32 PM, Wincent Colaiuta wrote:
Show 6 quoted lines
> El 2/5/2008, a las 23:47, Junio C Hamano escribió:
>> Pedro Melo <melo@simplicidade.org> writes:
>>
>>> inside an existing repository I want to create a new branch  
>>> without a
>>> parent commit. Is there a set of commands to do this?
[...]
> I wanted to do this just the other day, but I did it all inside the  
> one repo, and made some notes on the process here:
>
> http://rails.wincent.com/wiki/Creating_independent_branches_with_Git
This is exactly what I needed, thanks!
Best regards,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!
Pedro Melo· May 2, 2008, 23:04 UTC · re: Junio C Hamano · lore

Re: Parent-less branches

Hi,
On May 2, 2008, at 10:47 PM, Junio C Hamano wrote:
Show 16 quoted lines
> Pedro Melo <melo@simplicidade.org> writes:
>
>> inside an existing repository I want to create a new branch without a
>> parent commit. Is there a set of commands to do this?
>
> Typically these commits come about because you created a completely
> separate history elsewhere in a separate repository and fetched and/or
> pulled from there.
>
> So "a set of commands to do this" would be:
>
> 	go away
> 	git init
>         build history as usual
> 	come back
>         git fetch ..from that other repository..
Yes, that is what I was using until today.
I was asking for a in-repo solution, without the second git init.
The following email by Wincent Colaiuta does exactly what I wanted :).
Thanks!
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo@simplicidade.org
Use XMPP!
Randal L. Schwartz· May 2, 2008, 23:34 UTC · re: Pedro Melo · lore

Re: Parent-less branches

>>>>> "Pedro" == Pedro Melo <melo@simplicidade.org> writes:
Pedro> I was asking for a in-repo solution, without the second git init.
Why?  Are they charging you extra to type git init now? :)
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Johannes Schindelin· May 3, 2008, 14:05 UTC · re: Junio C Hamano · lore

Re: Parent-less branches

Hi,
On Fri, 2 May 2008, Junio C Hamano wrote:
Show 8 quoted lines
> Pedro Melo <melo@simplicidade.org> writes:
> 
> > inside an existing repository I want to create a new branch without a 
> > parent commit. Is there a set of commands to do this?
> 
> Typically these commits come about because you created a completely 
> separate history elsewhere in a separate repository and fetched and/or 
> pulled from there.

It is funny. I really like that approach, but too many people seem to be married to the concept that you have to stay in the same working directory, and rather play dirty tricks with the plumbing.

Ciao, Dscho

← back to recent threads