git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Parent-less branches
@ 2008-05-02 21:05 Pedro Melo
  2008-05-02 21:47 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Pedro Melo @ 2008-05-02 21:05 UTC (permalink / raw)
  To: Git Mailing List

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!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 21:05 Pedro Melo
@ 2008-05-02 21:47 ` Junio C Hamano
  2008-05-02 22:32   ` Wincent Colaiuta
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Junio C Hamano @ 2008-05-02 21:47 UTC (permalink / raw)
  To: Pedro Melo; +Cc: Git Mailing List

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..

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 21:47 ` Junio C Hamano
@ 2008-05-02 22:32   ` Wincent Colaiuta
  2008-05-02 23:04     ` Pedro Melo
  2008-05-02 23:04   ` Pedro Melo
  2008-05-03 14:05   ` Johannes Schindelin
  2 siblings, 1 reply; 11+ messages in thread
From: Wincent Colaiuta @ 2008-05-02 22:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pedro Melo, Git Mailing List

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?
>
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 21:47 ` Junio C Hamano
  2008-05-02 22:32   ` Wincent Colaiuta
@ 2008-05-02 23:04   ` Pedro Melo
  2008-05-02 23:34     ` Randal L. Schwartz
  2008-05-03 14:05   ` Johannes Schindelin
  2 siblings, 1 reply; 11+ messages in thread
From: Pedro Melo @ 2008-05-02 23:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Hi,

On May 2, 2008, at 10:47 PM, Junio C Hamano wrote:

> 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!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 22:32   ` Wincent Colaiuta
@ 2008-05-02 23:04     ` Pedro Melo
  0 siblings, 0 replies; 11+ messages in thread
From: Pedro Melo @ 2008-05-02 23:04 UTC (permalink / raw)
  To: Wincent Colaiuta; +Cc: Junio C Hamano, Git Mailing List

Hi,

On May 2, 2008, at 11:32 PM, Wincent Colaiuta wrote:

> 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!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
@ 2008-05-02 23:20 Ulrik Sverdrup
  2008-05-03  0:17 ` Jakub Narebski
  0 siblings, 1 reply; 11+ messages in thread
From: Ulrik Sverdrup @ 2008-05-02 23:20 UTC (permalink / raw)
  To: git; +Cc: win

> 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

I think I've seen this done much simpler, in this blog post:

http://madduck.net/blog/2007.07.11:creating-a-git-branch-without-ancestry/

Even though your instructions seem more complicated than they are since
they mix setting up the parentless branch and preparing the first
commit content.

regards,
ulrik

(I am not on the list, please CC)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 23:04   ` Pedro Melo
@ 2008-05-02 23:34     ` Randal L. Schwartz
  0 siblings, 0 replies; 11+ messages in thread
From: Randal L. Schwartz @ 2008-05-02 23:34 UTC (permalink / raw)
  To: Pedro Melo; +Cc: Junio C Hamano, Git Mailing List

>>>>> "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!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 23:20 Parent-less branches Ulrik Sverdrup
@ 2008-05-03  0:17 ` Jakub Narebski
  2008-05-03  0:46   ` Sverre Rabbelier
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Narebski @ 2008-05-03  0:17 UTC (permalink / raw)
  To: Ulrik Sverdrup; +Cc: git, Wincent Colaiuta, Junio C Hamano, Pedro Melo

Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
> Wincent Colaiuta <win@wincent.com> writes:
>>
>> 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.
> 
> I think I've seen this done much simpler, in this blog post:
> 
> http://madduck.net/blog/2007.07.11:creating-a-git-branch-without-ancestry/

And it is mentioned in http://git.or.cz/gitwiki/BlogPosts, athough not
yet in either GitTips or GitFaq.


In short the solution is to create content-less branch using:

  $ git symbolic-ref HEAD refs/heads/newbranch
  $ rm .git/index
 
then commit.

> Even though your instructions seem more complicated than they are since
> they mix setting up the parentless branch and preparing the first
> commit content.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-03  0:17 ` Jakub Narebski
@ 2008-05-03  0:46   ` Sverre Rabbelier
  2008-05-04  5:50     ` Daniel Barkalow
  0 siblings, 1 reply; 11+ messages in thread
From: Sverre Rabbelier @ 2008-05-03  0:46 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Ulrik Sverdrup, git, Wincent Colaiuta, Junio C Hamano, Pedro Melo

On Sat, May 3, 2008 at 2:17 AM, Jakub Narebski <jnareb@gmail.com> wrote:
>  In short the solution is to create content-less branch using:
>
>   $ git symbolic-ref HEAD refs/heads/newbranch
>   $ rm .git/index
>
>  then commit.

I guess what Pedro is asking is if there isn't a builtin way to do
this. Which, if I understand correctly, there isn't. Perhaps though
something like "git branch -N newbranchname" which then creates a new
parentless branch. It could just be a shell script that does the
above, but I wonder if there are no side-effects of the above? It
sounds somewhat 'messy' to remove the index? Too 'low level' to do for
a user I mean, what if sometime in the future we decide to store
something in the index that -is- important? I reckon it would be
cleaner to add an option for this.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-02 21:47 ` Junio C Hamano
  2008-05-02 22:32   ` Wincent Colaiuta
  2008-05-02 23:04   ` Pedro Melo
@ 2008-05-03 14:05   ` Johannes Schindelin
  2 siblings, 0 replies; 11+ messages in thread
From: Johannes Schindelin @ 2008-05-03 14:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pedro Melo, Git Mailing List

Hi,

On Fri, 2 May 2008, Junio C Hamano wrote:

> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Parent-less branches
  2008-05-03  0:46   ` Sverre Rabbelier
@ 2008-05-04  5:50     ` Daniel Barkalow
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Barkalow @ 2008-05-04  5:50 UTC (permalink / raw)
  To: sverre
  Cc: Jakub Narebski, Ulrik Sverdrup, git, Wincent Colaiuta,
	Junio C Hamano, Pedro Melo

On Sat, 3 May 2008, Sverre Rabbelier wrote:

> On Sat, May 3, 2008 at 2:17 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> >  In short the solution is to create content-less branch using:
> >
> >   $ git symbolic-ref HEAD refs/heads/newbranch
> >   $ rm .git/index
> >
> >  then commit.
> 
> I guess what Pedro is asking is if there isn't a builtin way to do
> this. Which, if I understand correctly, there isn't. Perhaps though
> something like "git branch -N newbranchname" which then creates a new
> parentless branch. It could just be a shell script that does the
> above, but I wonder if there are no side-effects of the above? It
> sounds somewhat 'messy' to remove the index? Too 'low level' to do for
> a user I mean, what if sometime in the future we decide to store
> something in the index that -is- important? I reckon it would be
> cleaner to add an option for this.

If sometime in the future we decide to store something in the index that 
is important, we'll definitely want to remove the index, because whatever 
it is will be both important and -wrong- for a new parentless commit, 
since a new root should have all the default values, not values acquired 
during the other history in the repo.

On the other hand, a builtin command of that sort probably ought to make 
sure that there aren't any uncommitted changes before doing this. And it 
should probably be called "git checkout -b name -N", since it makes it 
your current branch, rather than creating it like "git branch ..." would 
suggest.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-05-04  5:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 23:20 Parent-less branches Ulrik Sverdrup
2008-05-03  0:17 ` Jakub Narebski
2008-05-03  0:46   ` Sverre Rabbelier
2008-05-04  5:50     ` Daniel Barkalow
  -- strict thread matches above, loose matches on Subject: below --
2008-05-02 21:05 Pedro Melo
2008-05-02 21:47 ` Junio C Hamano
2008-05-02 22:32   ` Wincent Colaiuta
2008-05-02 23:04     ` Pedro Melo
2008-05-02 23:04   ` Pedro Melo
2008-05-02 23:34     ` Randal L. Schwartz
2008-05-03 14:05   ` Johannes Schindelin

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).