From: Junio C Hamano <gitster@pobox.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jari Aalto <jari.aalto@cante.net>, git@vger.kernel.org
Subject: Re: [PATCH] Documentation/git-reset.txt: Use HEAD~N syntax everywhere (unify examples)
Date: Sat, 02 Feb 2008 13:31:47 -0800 [thread overview]
Message-ID: <7vk5ln11vg.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080202161813.GA19797@fieldses.org
"J. Bruce Fields" <bfields@fieldses.org> writes:
>> It does not matter what advanced users use. The documentation should
>> primarily focus the newcomers.
>
> That could have been an argument for disallowing the HEAD^ syntax
> entirely, but it's too late for that.
It's not "it's too late" unless you are proposing to revamp git
and to remove support for nonlinear history. With ^ and digits
you can name anything. With ~ and digits you cannot.
> Even if we eradicated all mention of ^ from the in-tree documentation,
> it would still show up in lots of out-of-tree documentation and
> examples. So we have to introduce it to newbies. Fortunately, it isn't
> that hard.
Jari might be thinking that absolute newbies do not do any
merges themselves, but even then, people need to know $commit^2
as soon as they start to interact with a history that have any
merge. And people won't stay newbies forever.
> One way we can help them is by continuing to mix the two in examples, so
> let's continue with the current mixture.
Yeah, I am pretty much for it.
HEAD~2 and upwards are very good usability enhancement compared
to "HEAD^^^(many uparrows...)". The reason we accept HEAD~1 is
not because that is easier to type, nor easier to understand,
nor makes you more productive. It is solely for consistency for
the consistency's sake.
In an introductory document, we could present things in this
order:
1. "HEAD^" means the parent. It's parent is "HEAD^^".
Side note: You read the ^ operator from right to left.
When you see "HEAD^^", you read the rightmost ^ as "the
parent of", and tuck the remainder to form "the parent
of HEAD^".
2. You can have merges, so the above "_the_ parent" is a white
lie. The other branch that was merged is HEAD^2 (the second
parent).
Side note: this means "HEAD^" we introduced in 1. is
"the first parent"; a natural consequence of this is
that you could also say HEAD^1 if you really wanted to
be explicit.
3. As major parts of your history consists of a sequence of
commits that have only single parent, you would often need
to refer to ancestor that is Nth generation back following
the first parent. You can of course say "HEAD^^^^" to mean
the first parent of the first parent of the first parent of
the first parent of the HEAD, but that quickly becomes
combersome. Instead you can say HEAD~4.
Side note: "HEAD^" we introduced in 1. is "the first
generation ancestor in the first parent chain"; a
natural consequence of this is that you could also say
HEAD~1 if you really wanted to be explicit.
But that's for introductory document. Once people get past to
the stage and understand what these two notation mean, we should
freely use the more convenient form in the reference part of the
documentation.
next prev parent reply other threads:[~2008-02-02 21:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 1:41 [PATCH] Documentation/git-reset.txt: Use HEAD~N syntax everywhere (unify examples) Jari Aalto
2008-02-02 2:37 ` Johannes Schindelin
2008-02-02 2:59 ` Junio C Hamano
2008-02-02 8:44 ` Mike Hommey
2008-02-02 12:59 ` Jari Aalto
2008-02-02 13:37 ` Jakub Narebski
2008-02-02 20:10 ` Jari Aalto
2008-02-03 2:07 ` Johannes Schindelin
2008-02-02 16:18 ` J. Bruce Fields
2008-02-02 20:15 ` Jari Aalto
2008-02-02 22:39 ` Robin Rosenberg
2008-02-02 21:31 ` Junio C Hamano [this message]
2008-02-03 19:30 ` Dmitry Potapov
2008-02-03 23:48 ` Jari Aalto
2008-02-04 0:28 ` Jakub Narebski
2008-02-04 22:33 ` Dmitry Potapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vk5ln11vg.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bfields@fieldses.org \
--cc=git@vger.kernel.org \
--cc=jari.aalto@cante.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).