git natively supports - as an argument to git switch and git checkout. It is shorthand for @{-1}, which is a way to refer to the last branch you were on.
forgit used to interpret - as a branch name, detect that it does not exist yet and create a new one with this name, which does not work.
Add a check whether - is passed on the command line and do not create a new branch in this case
Check list
[x] I have performed a self-review of my code
[ ] I have commented my code in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
git natively supports
-
as an argument togit switch
andgit checkout
. It is shorthand for@{-1}
, which is a way to refer to the last branch you were on.forgit used to interpret
-
as a branch name, detect that it does not exist yet and create a new one with this name, which does not work.Add a check whether
-
is passed on the command line and do not create a new branch in this caseCheck list
Description
Type of change
Test environment