git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Vandiver <alex@chmrr.net>
To: git@vger.kernel.org
Subject: Tags named '-'
Date: Mon, 09 May 2011 11:21:36 -0400	[thread overview]
Message-ID: <1304954496.11377.11.camel@kohr-ah> (raw)

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

             reply	other threads:[~2011-05-09 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09 15:21 Alex Vandiver [this message]
2011-05-09 18:01 ` Tags named '-' Junio C Hamano
2011-05-09 22:56   ` [RFC/PATCH] tag: disallow '-' as tag name Michael Schubert
2011-05-09 23:08     ` Junio C Hamano
2011-05-09 23:36       ` [RFC/PATCH v2] " Michael Schubert
     [not found]         ` <BANLkTik7PYjGMMfxaNPubYR7M1OgBrF_qw@mail.gmail.com>
2011-05-10  9:47           ` Michael Schubert
2011-05-09 22:04 ` Tags named '-' Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304954496.11377.11.camel@kohr-ah \
    --to=alex@chmrr.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).