threads / discuss / 15273

How to create a branch without any links to the others branches

Subject: How to create a branch without any links to the others branches

## tl;dr

9 messages between Aug 29, 2008 and Aug 29, 2008.

replies: 8people: 4as markdown or json

Francis Moreau· Aug 29, 2008, 08:27 UTC · lore
Hello,
I'm wondering how such branches are created in a repository.

For example, how todo, man and html branches from the git repository have been created ?

Looking at git-branch man, a "start-point:" must be specified if not the current branch is assumed.

The only solution I'm seeing is to create a new repository with these 'unrelated' branches and pull them from the other repository.

Is this correct ?
Thanks
-- 
Francis
Alex Riesen· Aug 29, 2008, 09:27 UTC · re: Francis Moreau · lore

Re: How to create a branch without any links to the others branches

2008/8/29 Francis Moreau <francis.moro@gmail.com>:
Show 6 quoted lines
>
> The only solution I'm seeing is to create a new repository with these
> 'unrelated' branches and pull them from the other repository.
>
> Is this correct ?
>
Almost:

$ rm .git/HEAD $ echo ref: refs/heads/NEW-BRANCH-NAME > .git/HEAD $ git commit

Francis Moreau· Aug 29, 2008, 09:37 UTC · re: Alex Riesen · lore

Re: How to create a branch without any links to the others branches

On Fri, Aug 29, 2008 at 11:27 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 5 quoted lines
>
> $ rm .git/HEAD
> $ echo ref: refs/heads/NEW-BRANCH-NAME > .git/HEAD
> $ git commit
>
well, it looks pretty git internal hack thing to me.
Shouldn't we add a new option to git-branch to do that, like:
    $ git branch --detach <new-branch>
?
-- 
Francis
Alex Riesen· Aug 29, 2008, 09:46 UTC · re: Francis Moreau · lore

Re: How to create a branch without any links to the others branches

2008/8/29 Francis Moreau <francis.moro@gmail.com>:
Show 13 quoted lines
> On Fri, Aug 29, 2008 at 11:27 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
>>
>> $ rm .git/HEAD
>> $ echo ref: refs/heads/NEW-BRANCH-NAME > .git/HEAD
>> $ git commit
>>
>
> well, it looks pretty git internal hack thing to me.
>
> Shouldn't we add a new option to git-branch to do that, like:
>
>    $ git branch --detach <new-branch>
>
Dunno. I never needed that explicitly. What do you want to do with it?
Francis Moreau· Aug 29, 2008, 12:17 UTC · re: Alex Riesen · lore

Re: How to create a branch without any links to the others branches

On Fri, Aug 29, 2008 at 11:46 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
>
> Dunno. I never needed that explicitly. What do you want to do with it?
>
I'd like to create branches as Junio did for html, man and todo ones.
Thanks
-- 
Francis
Junio C Hamano· Aug 29, 2008, 15:04 UTC · re: Francis Moreau · lore

Re: How to create a branch without any links to the others branches

"Francis Moreau" <francis.moro@gmail.com> writes:
Show 6 quoted lines
> On Fri, Aug 29, 2008 at 11:46 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
>>
>> Dunno. I never needed that explicitly. What do you want to do with it?
>>
>
> I'd like to create branches as Junio did for html, man and todo ones.
If that is the objective...

There is no reason whatsoever for these unrelated branches to _ORIGINATE_ from the same source repository. The repositories you see at kernel.org and repo.or.cz are merely public distribution points, and I push them into a single repository at each of these places merely for downloaders convenience, from separate repositories.

Francis Moreau· Aug 29, 2008, 19:18 UTC · re: Junio C Hamano · lore

Re: How to create a branch without any links to the others branches

On Fri, Aug 29, 2008 at 5:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
> If that is the objective...
>
> There is no reason whatsoever for these unrelated branches to _ORIGINATE_
> from the same source repository.

Well I find sometimes convenient to embed some temporary working files and the project files at the same place.

>  The repositories you see at kernel.org
> and repo.or.cz are merely public distribution points, and I push them into
> a single repository at each of these places merely for downloaders
> convenience, from separate repositories.
OK.
thanks
-- 
Francis
Nguyen Thai Ngoc Duy· Aug 29, 2008, 12:34 UTC · re: Francis Moreau · lore

Re: How to create a branch without any links to the others branches

On 8/29/08, Francis Moreau <francis.moro@gmail.com> wrote:
Show 9 quoted lines
> On Fri, Aug 29, 2008 at 11:27 AM, Alex Riesen <raa.lkml@gmail.com> wrote:
>  >
>  > $ rm .git/HEAD
>  > $ echo ref: refs/heads/NEW-BRANCH-NAME > .git/HEAD
>  > $ git commit
>  >
>
>
> well, it looks pretty git internal hack thing to me.

There is an old thread that uses "git symbolic-ref" or something instead of "echo...", it would look less hacky. Or you could create a new repository, make a new branch there, then pull that branch to your repository.

-- 
Duy
Francis Moreau· Aug 29, 2008, 12:51 UTC · re: Nguyen Thai Ngoc Duy · lore

Re: How to create a branch without any links to the others branches

On Fri, Aug 29, 2008 at 2:34 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
> There is an old thread that uses "git symbolic-ref" or something
> instead of "echo...", it would look less hacky.
OK.
> Or you could create a new repository, make a new branch there,
> then pull that branch to your repository.

yes it's the only soultion I could come up with but I would have assumed git-branch to be able to do that.

Thanks
-- 
Francis

← back to recent threads