git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Parent-less branches

From
Jakub Narebski <jnareb@gmail.com>
Date
May 3, 2008, 00:17 UTC
Message-ID
<m38wys6y1q.fsf@localhost.localdomain>
In-Reply-To
<20080502232008.GA20092@ulrik-ibook>
Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
Show 12 quoted lines
> 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
Previous: Ulrik SverdrupNext: Sverre Rabbelier
Message 2 of 4 in “Re: Parent-less branches”
  1. Ulrik SverdrupMay 2, 2008
  2. Jakub NarebskiMay 3, 2008
  3. Sverre RabbelierMay 3, 2008
  4. Daniel BarkalowMay 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.