Git prefixes some branch names by spaced prefix, e.g. “+ “ for branch checked out in another working tree. Such names recognize as two parameters instead one and break the command.
Steps to reproduce
- Create any branch (e.g. branch1)
- Checkout master branch
- Create working tree
- Change directory to working tree directory
- Checkout branch1 in working tree
- Return to main repo directory
- Check name of branch1, must be “+ branch1“
- Try to checkout branch1
Valid git error message: fatal: 'branch1' is already checked out at '<working tree directory>'