git branch branchname
creates new branch "branchname", we know that.
However,
git branch --create branchname
also creates new branch "branchname":
yet the latter is not documented anywhere, not even in git docs.
I usually don't trust ChatGPT, but out of the curiosity, I've asked the same question to it, and it also says, that there is no git branch --create branchname
.
This is weird.
Any tips?
git branch branchname
creates new branch "branchname", we know that.
However,
git branch --create branchname
also creates new branch "branchname":
yet the latter is not documented anywhere, not even in git docs.
I usually don't trust ChatGPT, but out of the curiosity, I've asked the same question to it, and it also says, that there is no git branch --create branchname
.
This is weird.
Any tips?
Share Improve this question asked Mar 17 at 14:32 Gii TsiklauriGii Tsiklauri 11.3k9 gold badges56 silver badges83 bronze badges 17 | Show 12 more comments1 Answer
Reset to default 5Your git branch --create foo
is assumed by git to be git branch --create-reflog foo
because no other option starts with --create
As confusing as it can be to quite a lot of people, it's git's way to interpret incomplete option names.
One can abbreviate long options as long as it's unique. (doc)
--create-reflog
, I guess? You can shorten long option names as long as it's unique – Romain Valeri Commented Mar 17 at 14:37git branch <branch>
creates a branch (2)--create-reflog
is an option you can provide (3) you can shorten that option to--create
or--create-r
(however short as long as it is not ambigious) (4)git branch --create <branch>
is the same asgit branch --create-reflog <branch>
. – Guildenstern Commented Mar 17 at 14:46