Re: [PATCH] git-commit.txt: better description what it does
- Date: Thu, 31 Jan 2019 19:21:05 -0500
- From: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
- Subject: Re: [PATCH] git-commit.txt: better description what it does
On Thu, Jan 31, 2019 at 6:04 AM Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> On Thu, Jan 31, 2019 at 5:49 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> > On Thu, Jan 31, 2019 at 4:21 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> > > +NOTES
> > > +-----
> > > +If a branch is associated with the working tree, 'HEAD' points to this
> > > +branch. When a new commit is created, the branch is updated to point
> > > +to the new commit. As a result, resolving 'HEAD' still gives the new
> > > +commit.
> > > +
> > > +If no branch is associated with the working tree (i.e. "detached HEAD"
> > > +as described in linkgit:git-checkout), 'HEAD' records the object
> > > +name of the previous commit directly. When a new commit is created, it
> > > +will be updated to point to the new commit.
> > I'm having a hard time figuring out what these two paragraphs together
> > want to say. I _think_ they want to say that HEAD is updated
> > automatically to point at the latest commit, and that if a branch
> > points at HEAD, then the branch is is updated along with HEAD,
> > otherwise if no branch, then it's a "detached HEAD".
> I felt some more explanation was needed when I mentioned about
> updating current branch in the description, but then what happens when
> there's no branch (aka detached HEAD)? There is still some updates. If
> you consider HEAD a branch, then it's ok, but otherwise something is
> missing. But perhaps this is the kind of details that could be left
It could be left out or incorporated directly into the DESCRIPTION
section with a link to the much more thorough discussion of detached
HEAD in git-checkout documentation. Here's my attempt at rewriting
DESCRIPTION (and dropping NOTES altogether):
Create a new commit containing the current contents of the index
and the given log message describing the changes. The new commit
is a direct child of HEAD, usually the tip of the current branch,
and the branch is updated to point to it (unless no branch is
associated with the working tree, in which case HEAD is "detached"
as described in linkgit:git-checkout).
(I also streamlined the above a bit from what you had composed.)