gitgit-branch

git branch --create branchname works fine, but is not documented anywhere


git branch branchname creates new branch "branchname", we know that.

However,

git branch --create branchname also creates new branch "branchname": enter image description here

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?


Solution

  • Your 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)