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

Tags named '-'

From
Alex Vandiver <alex@chmrr.net>
Date
May 9, 2011, 15:21 UTC
Message-ID
<1304954496.11377.11.camel@kohr-ah>
Heya,
  The functionality of `git checkout -` is very useful, and I am hopeful
that `git merge -` will eventually land, as it matches my workflow well
as well.  However, the porcelain is not entirely consistent about
forbidding '-' as a ref name:
        ~/tmp $ git init
        Initialized empty Git repository in /home/chmrr/tmp/.git/
        ~/tmp (master #) $ git commit --allow-empty -m 'First commit'
        [master (root-commit) b7402ef] First commit
        ~/tmp (master) $ git checkout -b other
        Switched to a new branch 'other'
        ~/tmp (other) $ git checkout -
        Switched to branch 'master'
        ~/tmp (master) $ git checkout -b -
        fatal: git checkout: we do not like '-' as a branch name.
        ~/tmp (master) $ git tag -
        ~/tmp (master) $ git tag -l
        -
        ~/tmp (master) $ git checkout -
        Switched to branch 'other'
The likely best fix is to disallow '-' as a tag name, as well, which
would be handy because the typo of leaving off the 'l' on '-l', for
example, which is not an uncommon mistake that I have seen.
 - Alex
Next: Junio C Hamano
Message 1 of 7 in “Tags named '-'”
  1. Alex VandiverMay 9, 2011
  2. Junio C HamanoMay 9, 2011
  3. tag: disallow '-' as tag nameMichael Schubert, May 9, 2011
  4. Junio C HamanoMay 9, 2011
  5. tag: disallow '-' as tag nameMichael Schubert, May 9, 2011
  6. Sverre RabbelierMay 9, 2011
  7. Michael SchubertMay 10, 2011

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.