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

Re: [PATCH] Documentation/git-reset.txt: Use HEAD~N syntax everywhere (unify examples)

From
Jari Aalto <jari.aalto@cante.net>
Date
Feb 2, 2008, 12:59 UTC
Message-ID
<8x235xa8.fsf@blue.sea.net>
In-Reply-To
<20080202084406.GA15305@glandium.org>
* Sat 2008-02-02 Mike Hommey <mh@glandium.org> gmane.comp.version-control.git
* Message-Id: 20080202084406.GA15305@glandium.org
Show 7 quoted lines
>> 
>> > -$ git reset --soft HEAD^      <1>
>> > +$ git reset --soft HEAD~1     <1>
>> > -<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad
>> > +<1> The last three commits (HEAD, HEAD~1, and HEAD~2) were bad
>> > -$ git reset --soft HEAD^ ;# go back to WIP state  <2>
>> > +$ git reset --soft HEAD~1 ;# go back to WIP state <2>
>> People need to refer to the HEAD^ (one commit ago) much more
>> often than HEAD~N for larger values of N. 

I use HEAD~1 always, because I think the consistency in learning the most important factor.

It does not matter what advanced users use. The documentation should primarily focus the newcomers.

The first question a newbie asks, if manual pages mixes syntaxes:
    What the heck "^" ?. I just saw HEAD~N, is the other one somehow
    special?
All the other examples refer to
    HEAD~N

Those used to git may prefer ^, but it does not follow that others necessarily do so and that that should be the "proper learning path". People usually migrate to git from other VCSs, which have very consistent UI - There are no alternatives

    -r1:10      Subversion
    -r1..19     Bzr
    ...etc

It's unfortunate is the focus is given to comments like "easier type", when the context is the manual pages.

>> Especially about HEAD~1, nobody sane would type that.

You consider all such users insane? It actually helps to select onlyt one sytax, and HEAD~N is much more readable without further explanations, (becasue people are already used to knowing, from other VCSs, what a HEAD or TIP is). It's not all that different from prefering the "--quiet" over "-q" e.g. e.g. in shell scripts.

Jari
-- 
Welcome to FOSS revolution: we fix and modify until it shines
Previous: Mike HommeyNext: Jakub Narebski
Message 5 of 16 in “Documentation/git-reset.txt: Use HEAD~N syntax everywhere (unify examples)”
  1. Documentation/git-reset.txt: Use HEAD~N syntax everywhere (unify examples)Jari Aalto, Feb 2, 2008
  2. Johannes SchindelinFeb 2, 2008
  3. Junio C HamanoFeb 2, 2008
  4. Mike HommeyFeb 2, 2008
  5. Jari AaltoFeb 2, 2008
  6. Jakub NarebskiFeb 2, 2008
  7. Jari AaltoFeb 2, 2008
  8. Johannes SchindelinFeb 3, 2008
  9. J. Bruce FieldsFeb 2, 2008
  10. Jari AaltoFeb 2, 2008
  11. Robin RosenbergFeb 2, 2008
  12. Junio C HamanoFeb 2, 2008
  13. Dmitry PotapovFeb 3, 2008
  14. Jari AaltoFeb 3, 2008
  15. Jakub NarebskiFeb 4, 2008
  16. Dmitry PotapovFeb 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.