git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] help: show help for aliases

From
TKTom Kunze <mail@tom-kunze.de>
Date
Feb 10, 2017, 00:17 UTC
Message-ID
<137f35a4-ec2e-b8aa-c6a5-b17688eca61a@tomabrafix.de>

If an alias is a single git command show the man page of the aliased git command with --help.

Signed-off-by: Tom Kunze <mail@tom-kunze.de>
---
Hi,

I noticed that when I pass --help to an alias which is only a git command it tells me a information about the alias. But it would be nice if it instead opens the corresponding man page of the command.

There is a memory leak but in my opinion it can be ignored because the process will be replaced anyway.

Regards, Tom Kunze

PS: Please add me to cc as I am not subscribed.
 builtin/help.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/builtin/help.c b/builtin/help.c
index 49f7a07..655ed49 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -437,6 +437,10 @@ static const char *check_git_cmd(const char* cmd)

 	alias = alias_lookup(cmd);
 	if (alias) {
+		if (alias[0] != '!') {
+			strtok(alias, " \t\n");
+			return alias;
+		}
 		printf_ln(_("`git %s' is aliased to `%s'"), cmd, alias);
 		free(alias);
 		exit(0);
-- 
2.1.4
Next: Junio C Hamano
Message 1 of 2 in “help: show help for aliases”
  1. help: show help for aliasesTom Kunze, Feb 10, 2017
  2. Junio C HamanoFeb 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.