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

Re: git alias for options

From
hIpPy <hippy2981@gmail.com>
Date
Feb 17, 2017, 22:34 UTC
Message-ID
<CAM_JFCzoouREM5-6aq9wb0ouT34GKCoJ_pcsww5TYKAdztR9sA@mail.gmail.com>
In-Reply-To
<xmqq4lzsqwjy.fsf@gitster.mtv.corp.google.com>
I think the conversation has drifted away from what I am asking / hoping for.

I apologize but I do not feel in the position of submitting patches yet. I'll first need to read some code first before that.

I'm coming from the angle where currently I can alias just the command (ex: l for log) not considering the 'command with options'.

[alias]
  l = log
Currently, the order is as follows:

If built-in git command then it wins. If custom git command (script as git-l) then it wins. If alias for git command then it wins. Else throw as unknown command.

In short, built-in git command > custom git command > git alias.
So I think, the same could also be used for options.

Say I want an alias for option --name-status as -s, so I can type: $ git log -s

But there is already a -s option and that wins so the built-in option alias wins.

However, I think I should be able alias it as --ns. $ git log --ns

Thanks, hippy

Previous: Junio C HamanoNext: Jeff King
Message 8 of 9 in “git alias for options”
  1. hIpPyFeb 17, 2017
  2. Michael J GruberFeb 17, 2017
  3. Ævar Arnfjörð BjarmasonFeb 17, 2017
  4. Jeff KingFeb 17, 2017
  5. Ævar Arnfjörð BjarmasonFeb 17, 2017
  6. Jeff KingFeb 17, 2017
  7. Junio C HamanoFeb 17, 2017
  8. hIpPyFeb 17, 2017
  9. Jeff KingFeb 18, 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.