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

Re: How to create a new branch based on a tag?

From
BLBen Lau <benlau@ust.hk>
Date
Oct 21, 2005, 16:15 UTC
Message-ID
<43591421.9030400@ust.hk>
In-Reply-To
<46a038f90510202037l7dd40271qcc0634295e092068@mail.gmail.com>
Martin Langhoff wrote:
Show 34 quoted lines
>On 10/22/05, Ben Lau <benlau@ust.hk> wrote:
>  
>
>>Hi,
>>
>>   I would like to create a branch of my own work based on a specific
>>kernel version(i.e
>>v2.6.11). I tried with:
>>
>> > git-branch my2.6.11 v2.6.11
>>error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not a
>>commit
>>fatal: Needed a single revision
>>    
>>
>
>What you're after is
>
>   git-rev-parse --verify <tagname>^0  > .refs/heads/mynewbranch
>
>"branches" are very lightweight -- it's a ref containing the SHA1 of
>the commit you want it to be at. So if you find the SHA1 of the commit
>in gitk or wherever, just
>
>  echo SHA1 > .refs/heads/mynewbranch
>
>and you're sorted. Do git-checkout to switch to it.
>
>cheers,
>
>
>martin
>  
>
The command complains:
   >git-rev-parse --verify v2.6.11^
   error: Object 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c is a tree, not 
a commit
   fatal: Needed a single revision
I think it need another way to convert a tag/tree object into a commit ?
Previous: Martin LanghoffNext: Junio C Hamano
Message 3 of 8 in “How to create a new branch based on a tag?”
  1. Ben LauOct 21, 2005
  2. Martin LanghoffOct 21, 2005
  3. Ben LauOct 21, 2005
  4. Junio C HamanoOct 21, 2005
  5. Ben LauOct 21, 2005
  6. Junio C HamanoOct 21, 2005
  7. Ben LauOct 21, 2005
  8. Junio C HamanoOct 21, 2005

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.