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

Subtle git completion hacks with aliases

From
USUlrik Sverdrup <ulrik.sverdrup@gmail.com>
Date
Feb 12, 2010, 13:40 UTC
Message-ID
<a1b6cb1b1002120540o8ff8f50vec1c7b528d462b8a@mail.gmail.com>

Relying on git refusing to use aliases that shadow git commands (and rightly so), but the git completion script taking them at face value, we can customize the completion of plumbing and custom scripts.

[alias]
        # Make this plumbing command autocomplete
        count-objects =
        # Make this custom shell script (git-unmerged)  autocomplete
arguments as branches, not paths
        unmerged = log

Given the firm beliefs in the aliases-shadowing-commands question, I think the above should be pretty safe.

Ulrik
Message 1 of 1 in “Subtle git completion hacks with aliases”
  1. Ulrik SverdrupFeb 12, 2010

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.