git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* -h prints alias information even for grep
@ 2025-07-25  8:17 Kevin Brodsky
  2025-07-25 18:41 ` [PATCH] git: show alias info only with lone -h René Scharfe
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Brodsky @ 2025-07-25  8:17 UTC (permalink / raw)
  To: git

Hi,

I've noticed a strange interaction that probably wasn't intended.

The -h flag typically means "help", and if passed to an aliased command
an extra line is printed to describe the alias. This also holds for the
grep command, if no other argument is passed.

Things get weirder if grep is passed valid arguments, because in that
case -h means something else (suppressing filename output). Of course no
help message is printed in that case, but the alias information is still
printed!

Example:

$ git g -h -A20 alias .gitconfig
'g' is aliased to 'grep'
[alias]
[...]
    g    = grep

----

It seems like that alias information line should be tied to the printing
of the help message, rather than the -h flag?

I noticed this behaviour years ago and I still do with the latest
version of Git (2.50.1).

Cheers,
Kevin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-07-29  7:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25  8:17 -h prints alias information even for grep Kevin Brodsky
2025-07-25 18:41 ` [PATCH] git: show alias info only with lone -h René Scharfe
2025-07-25 23:52   ` Junio C Hamano
2025-07-26  8:12     ` Jeff King
2025-07-26 13:12       ` D. Ben Knoble
2025-07-26 14:22         ` D. Ben Knoble
2025-07-29  7:23         ` Jeff King
2025-07-28 13:43       ` Junio C Hamano
2025-07-29  7:26         ` Jeff King

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).