Re: How to display "HEAD~*" in "git log"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 06, 2022 at 12:49:08PM -0400, Jeff King wrote:

[...]
> > I pondered about `git name-rev` but failed to figure out how to make it accept
> > just "HEAD" as the point of reference. Passing it "--refs=HEAD"
> > (or "--refs HEAD", FWIW) does not appear to do what I'd expect it to: a couple
> > of top commits are not annotated at all, and then they start to get annotated
> > relative to "origin/HEAD". Note that I've tested this on a detached HEAD which
> > contains an unmerged line of history.
> 
> Right. The problem is that it gets the set of possible ref tips with
> for_each_ref(), which will not include HEAD. And then worse, since the
> argument to "--refs" is a pattern, it matches junk like origin/HEAD.

Do I assume correctly that `git for-each-ref HEAD` does nothing, successfully,
for the very same reason?
If so, I wonder if this should be somehow reflected in the docs.
I mean, I have always maintained an impression that things like HEAD,
ORIGIN_HEAD, FETCH_HEAD etc are also "refs" - because they, well, reference
commits or branches.

The gitglossary manual page of my Git 2.30.2 states that

| ref
|   A name that begins with refs/ (e.g. refs/heads/master)
| <...>
|   There are a few special-purpose refs that do not begin with refs/.
|   The most notable example is HEAD.

which suggests that HEAD is a ref.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux