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

Bash completion for git aliases containing nested subcommands

From
Tim Jaacks <timjaacks@posteo.de>
Date
Oct 3, 2022, 11:45 UTC
Message-ID
<em8d7ca854-51a3-4cb5-aaf9-30ed37b4194b@acer-switch-tim>
Hello everyone,
I have set up the following alias in my .gitconfig file:
[alias]
     ss = stash show

Unfortunately bash completion does not work correctly on this alias. When I type "git ss <TAB>", I get:

$ git ss <TAB> apply clear drop pop show branch create list push

Which is obviously the completion for "git stash" instead of "git stash show".

With the original command I get the list of available stashes:

$ git stash show <TAB> stash@{0} stash@{1}

Is there a way to get the completion on the alias behave like on the original command?

I am on Ubuntu 20.04 and using the distro's default git completions.

Kind regards, Tim

Next: SZEDER Gábor
Message 1 of 7 in “Bash completion for git aliases containing nested subcommands”
  1. Tim JaacksOct 3, 2022
  2. SZEDER GáborOct 3, 2022
  3. Jeff KingOct 3, 2022
  4. Tim JaacksOct 4, 2022
  5. SZEDER GáborOct 5, 2022
  6. Tim JaacksOct 3, 2022
  7. SZEDER GáborOct 3, 2022

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.