I have noticed a strange behaviour while using git.
Let's say I work on this repository, just an example of a repository with several branches.
I will just show the sequence of commands with relative answers, then briefly explain what I don't understand:
>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
>git branch
* master
>git checkout develop
error: pathspec 'develop' did not match any file(s) known to git.
>git checkout Develop
Switched to a new branch 'Develop'
Branch 'Develop' set up to track remote branch 'Develop' from 'origin'.
>git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
>git branch
Develop
* master
>git checkout develop
Switched to branch 'develop'
>git branch
Develop
master
>git status
On branch develop
nothing to commit, working tree clean
I basically checkout a remote branch but make a mistake in the name case. If I have no local branch that tracks the remote (so if I have no branch equal to the one I want to checkout with a different casing), it fails, otherwise I end up in this stange state where I am on a non existent branch ( it's not the one uppercase, as git branch does not mark it with a star). What is it happening?
EDIT: To address the duplicate flag and the comments: I know it is a problem of branches being case sensitive, it is not that. My question is more specifically: Why the second wrong checkout does not fail but takes me to this strange situation?
The output being requested in comment is:
>git branch -av
Develop 4fc788f pdf added3
master 4fc788f pdf added3
remotes/origin/Develop 4fc788f pdf added3
remotes/origin/HEAD -> origin/master
remotes/origin/master 4fc788f pdf added3
>git --version
git version 2.17.1.windows.2