From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'COLLOMB Joris -EXT'" <joris.collomb-ext@alstomgroup.com>,
<git@vger.kernel.org>
Subject: RE: Git checkout multiple options issue
Date: Mon, 28 Jan 2019 10:20:02 -0500 [thread overview]
Message-ID: <000701d4b71c$f3ba57f0$db2f07d0$@nexbridge.com> (raw)
In-Reply-To: <HE1PR01MB3722D90668E75E4BCDBA71F2A9960@HE1PR01MB3722.eurprd01.prod.exchangelabs.com>
On January 28, 2019 9:25, COLLOMB Joris wrote:
> -----Message d'origine-----
>> De : Randall S. Becker <rsbecker@nexbridge.com> Envoyé : lundi 28 janvier
>> 2019 15:12 À : COLLOMB Joris -EXT <joris.collomb-ext@alstomgroup.com>;
>> git@vger.kernel.org Objet : RE: Git checkout multiple options issue
>>
>> On January 28, 2019 8:25, COLLOMB Joris wrote:
>> > git checkout -fb "branch_name"
>> > (force branch creation and checkout it)
>> >
>> > doesn't work (even if option a separated).
>> >
>> > I don't know if this is consider as an issue, but here it is.
>>
>> I think you might mean (which works on every platform I have):
>>
>> git checkout -f -b "branch_name"
>>
>> There is no provision for aggregating options into one. -fb (invalid) is
not the
>> same as -f -b (valid).
> git checkout -f -b "branch_name"
> gives me " Fatal: A branch named 'branch_name' already exists."
Once the branch is created, you can't force its creation, because it is
already created. Just
git checkout "branch_name"
is sufficient at this point. git is correct to complain that you are trying
to create a branch that already exists.
git log --decorate --oneline --graph --all
will show you where your branch points in history at any given moment in
time in a convenient form.
> I understand that here the checkout is force, but not the branch creation.
> The opposite option order doesn't work:
>
> git checkout -b -f "branch_name"
> gives me "Fatal: '-f' is not a valid branch name."
In this case, you are asking git to create a branch named -f (the -b branch
option). Then "branch_name" becomes the reference that would be used to find
the commit that -f would have pointed to. However, -f is not a valid name
because it is an option and git is correct to reject it.
git checkout options are described here:
https://git-scm.com/docs/git-checkout
Regards,
Randall
next prev parent reply other threads:[~2019-01-28 15:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 13:25 Git checkout multiple options issue COLLOMB Joris -EXT
2019-01-28 14:12 ` Randall S. Becker
2019-01-28 14:24 ` COLLOMB Joris -EXT
2019-01-28 15:20 ` Randall S. Becker [this message]
2019-01-28 16:02 ` COLLOMB Joris -EXT
2019-01-28 16:37 ` Randall S. Becker
2019-01-28 16:55 ` Kevin Daudt
2019-01-28 17:29 ` Junio C Hamano
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='000701d4b71c$f3ba57f0$db2f07d0$@nexbridge.com' \
--to=rsbecker@nexbridge.com \
--cc=git@vger.kernel.org \
--cc=joris.collomb-ext@alstomgroup.com \
/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).