From: Junio C Hamano Date: Wed, 23 Jul 2008 23:04:08 GMT Subject: Re: [PATCH 2/2] git-checkout: improve error messages, detect ambiguities. Message-ID: <7v7ibc9p93.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1216808133-31919-3-git-send-email-madcoder@debian.org> Pierre Habouzit writes: > The patch is twofold: it moves the option consistency checks just under > the parse_options call so that it doesn't get in the way of the tree > reference vs. pathspecs desambiguation. I think this goes a bit too far. Even if you have a file called 'master' tracked in your project, when you say: $ git checkout master that's almost always branch switching. Forcing "git checkout master --" disambiguation for such a common case is simply a wrong thing to do from the usability point of view. So how about (obviously we are interested only in the case without disambiguating '--' here): (3-1) if there is only one token left and if it is a rev, that's the branch to check out or commit to detach to. (3-2) otherwise the user might have mistyped one of the paths, so help avoiding by making sure the first token is unambiguously either a rev or a path (but not both).