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
Mike Hommey <mh@glandium.org>
Date
Feb 2, 2008, 08:44 UTC
Message-ID
<20080202084406.GA15305@glandium.org>
In-Reply-To
<7v7iho6p2m.fsf@gitster.siamese.dyndns.org>
On Fri, Feb 01, 2008 at 06:59:29PM -0800, Junio C Hamano wrote:
Show 27 quoted lines
> Jari Aalto <jari.aalto@cante.net> writes:
> 
> > The examples in the documentation refer to multiple ~N commits. To
> > Keep the exampels unified with the same syntax, use ~N in all examples.
> >
> > Signed-off-by: Jari Aalto <jari.aalto AT cante.net>
> 
> > -$ 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>
> 
> I personally think this is a regression, not an improvement.
> 
> People need to refer to the HEAD^ (one commit ago) much more
> often than HEAD~N for larger values of N.  And we should give
> them exposure to HEAD^ and HEAD^^; both are faster and easier to
> type and read than HEAD~1 and HEAD~2.
> 
> Especially about HEAD~1, nobody sane would type that.  It is
> there only for consistency.
> 
> Otherwise, twisted people would complain "I can say HEAD~4
> instead of HEAD^^^^ and it helps brevity; but it is inconsistent
> that I cannot say HEAD~1 instead of HEAD^".

I wonder if it wouldn't make sense to have ^ described with ^1 ^2, and add the possibility to also have ~, which would have the same meaning by side effect, described with ~1 ~2, etc.

The problem with ^ being described with ~1 ~2 is that it makes things harder to understand than they actually are. The real problem being that ^ sounds like having different meanings depending whether it's followed by a number or not.

Mike
Previous: Junio C HamanoNext: Jari Aalto
Message 4 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.