I recently started learning git and I've run into a behavior I don't quite understand.
I have two branches:
C:\Users\MyUserName\MyProject>git branch
* MyBranch
master
git makes it very clear that there are two branches and that MyBranch is currently selected by highlighting it in green and putting an asterisk next to it.
Switching to the main branch looks like this:
C:\Users\MyUserName\MyProject>git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
C:\Users\MyUserName\MyProject>git branch
MyBranch
* master
All of this is fine until I do this:
C:\Users\MyUserName\MyProject>git checkout mybranch
Switched to branch 'mybrach'
C:\Users\MyUserName\MyProject>git branch
MyBranch
master
None of my branches are currently highlighted as selected, no errors were thrown at me for checking into a branch that doesn't exist and neither was a lowercase copy of MyBranch created. However, git apparently completed the selection successfully as it states "Switched to branch 'mybranch' "
I figured this was specifically a case-sensitivity issue very quickly since trying to checkout to a branch name that doesn't exist would throw an error:
C:\Users\MyUserName\MyProject>git checkout random
error: pathspec 'random' did not match any file(s) known to git
What's happening here? Does git actually make the switch but chooses not to highlight or no switch happens but git still displays a "switched" message?