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

Bash completion suggests tags for git branch -D

From
Paul Jolly <paul@myitcv.io>
Date
Feb 2, 2021, 06:01 UTC
Message-ID
<CACoUkn6+9C3+HVVQF905t1siAD9Sqo1JvRa0Whw-J6x7V7icyg@mail.gmail.com>
Hi,
Easiest explained via a repro:
    cd $(mktemp -d)
    git init
    touch README
    git add -A
    git commit -am 'Initial commit'
    git checkout -b branch
    git tag b-is-a-tag
If you then type:
    git branch -D b^

leaving the cursor at the position shown by the caret, then attempt completion via <Tab><Tab> (at least according to my bash setup) two options are shown:

    b-is-a-tag   branch

b-is-a-tag is not a branch, so should not be offered as a completion candidate in this instance.

Many thanks,
Paul
Next: Jeff King
Message 1 of 10 in “Bash completion suggests tags for git branch -D”
  1. Paul JollyFeb 2, 2021
  2. Jeff KingFeb 2, 2021
  3. Jeff KingFeb 2, 2021
  4. Junio C HamanoFeb 2, 2021
  5. Eric SunshineFeb 2, 2021
  6. Junio C HamanoFeb 2, 2021
  7. Jeff KingFeb 2, 2021
  8. Paul JollyFeb 2, 2021
  9. SZEDER GáborFeb 3, 2021
  10. completion: handle other variants of "branch -m"Jeff King, Feb 3, 2021

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.