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

Bash completion does not offer bare name origin where remote head is set

From
Paul Jolly <paul@myitcv.io>
Date
Aug 21, 2020, 14:03 UTC
Message-ID
<CACoUkn7D52ox2MgUfS2uQtLa28twccfxnQnUteVV_yFfVLFQdQ@mail.gmail.com>
Hi,
In some of my repositories I use either:
    git remote set-head origin -a
or the more explicit:
    git remote set-head origin main

to set the remote default branch. My understanding is that this then allows me to use the name "origin" to refer to (in the second case) "origin/main".

However, testing git version 2.28.0.308.g675a4aaf3b, bash completion does not offer the name "origin" as a valid completion.

For example if I type:
    git checkout ori
and hit <Tab>, the command completes to:
    git checkout origin/

(notice the trailing slash). Which means I then either need to hit <Backspace> to remove the slash, or I have to remember the default branch name of the remote. Either is a slight annoyance... which multiplied many times a day becomes painful!

Ideally I would like the <Tab> completion to result in:
    git checkout origin

(notice no trailing slash), i.e to know that the bare name "origin" is valid by itself.

With many repositories renaming their default branch from master to main, git remote set-head has become essential. It would be ideal to have completion help support this.

Many thanks,
Paul
Message 1 of 1 in “Bash completion does not offer bare name origin where remote head is set”
  1. Paul JollyAug 21, 2020

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.