# [BUG] potential error in parsing git checkout options?

2 messages from 2015-05-29 to 2015-05-29. Participants: Guillaume Pages, Matthieu Moy.
Thread: https://gitlist.dev/t/39458

## Guillaume Pages, 2015-05-29 10:30

Subject: [BUG] potential error in parsing git checkout options?
Message-ID: <854038739.144343.1432895421483.JavaMail.zimbra@ensimag.grenoble-inp.fr>
URL: https://gitlist.dev/e/854038739.144343.1432895421483.JavaMail.zimbra%40ensimag.grenoble-inp.fr
In-Reply-To: <156258182.144342.1432895411512.JavaMail.zimbra@ensimag.grenoble-inp.fr>

```
Git version : 2.4.1.652.g8fd8657 

When we run git checkout -babar, we would expect an error message like 
"unknown switch 'a' " and we get "Switched to a new branch 'abar'". We 
are not sure since we don't entirely understand the syntax -b <branch> 
which is shown in the documentation, but as average users, we found it 
a bit surprising. 


Guillaume Pagès

```

## Matthieu Moy, 2015-05-29 12:23

Subject: Re: [BUG] potential error in parsing git checkout options?
Message-ID: <vpqiobb7eu1.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqiobb7eu1.fsf%40anie.imag.fr
In-Reply-To: <854038739.144343.1432895421483.JavaMail.zimbra@ensimag.grenoble-inp.fr>

```
Guillaume Pages <guillaume.pages@ensimag.grenoble-inp.fr> writes:

> Git version : 2.4.1.652.g8fd8657 
>
> When we run git checkout -babar, we would expect an error message like 
> "unknown switch 'a' " and we get "Switched to a new branch 'abar'".

Yes, the option-parser accepts sticked form (-bbranch) and unsticked (-b
branch). This is the convention with most Unix commands (try "grep -e
foo" Vs "grep -efoo").

It gets more confusing for "git -amend" Vs "git --amend", which got a
special-case to avoid confusion (strictly speaking, it should have been
equivalent to "git commit -a -m end").

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```
