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 10:38:37AM -0400, Jeff King wrote:

[...]

> > You can script this. Provided you have a POSIX-compatible shell (such as
> > Bash), the encantation would read something like
> > 
> >  $ git log --oneline | { n=0; while read line; do printf '%d\t%s\n' $n "$line"; done; }
> 
> That will just number the commits linearly as they are printed. If your
> history has any branches or merges, eventually it will get out of sync.

Thanks, I did not think of this.

> You can use "name-rev" to annotate commits with names that respect the
> history. It only matches full oids, so try:
> 
>   git log --oneline --no-abbrev | git name-rev --stdin

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.

[...]




[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