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

Re: Tilde spec - befuzzled

From
Andreas Ericsson <ae@op5.se>
Date
Feb 28, 2012, 09:50 UTC
Message-ID
<4F4CA354.2070503@op5.se>
In-Reply-To
<4F4C995D.9000504@diamand.org>
On 02/28/2012 10:07 AM, Luke Diamand wrote:
Show 15 quoted lines
> The documentation for caret and tilde specs is making my head hurt, even though they always _do_ exactly what I want. And I thought I understood them until I read more carefully.
> 
> A suffix '{caret}' to a revision parameter means the first parent of
> that commit object. '{caret}<n>' means the <n>th parent (i.e.
> '<rev>{caret}'
> 
> So far, so good.
> 
> '<rev>{tilde}<n>', e.g. 'master{tilde}3'::
> A suffix '{tilde}<n>' to a revision parameter means the commit
> object that is the <n>th generation grand-parent of the named
> commit object, following only the first parents.
> 
> Hang on, *grand*-parents?
> 

Replace "grand-parent" with "ancestor" and your head might hurt a little less. Caret only ever describes parent, while tilde can describe either parent or n'th generation grand-parent. Since parent and grand-parent are all ancestors, that would be a better term.

I believe this stems from the fact that most git-gurus use a single caret to specify 'parent' and only go to the tilde when they want grandparents. It might be because caret was implemented first, or because of english keyboard layout. On swedish keyboards, using tilde is far more convenient than using caret, so that's what I mostly use when I want the parent of a single-parent commit (it requires only one hand and no thumb-acrobatics even on my laptop).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Luke DiamandNext: Thomas Rast
Message 2 of 10 in “Tilde spec - befuzzled”
  1. Luke DiamandFeb 28, 2012
  2. Andreas EricssonFeb 28, 2012
  3. Thomas RastFeb 28, 2012
  4. Junio C HamanoFeb 28, 2012
  5. Andrew ArdillFeb 29, 2012
  6. Jeff KingFeb 29, 2012
  7. Andreas EricssonFeb 29, 2012
  8. Andreas EricssonFeb 29, 2012
  9. Re*: Tilde spec - befuzzledJunio C Hamano, Feb 29, 2012
  10. Luke DiamandMar 2, 2012

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.