git: "error: pathspec 'feature-x' did not match any file(s) known to git" when switching to a teammate's branch
@devsingh05▲ 10 net votes
Your clone does not know the branch yet. Run git fetch origin, then git switch feature-x (git creates a local branch tracking origin/feature-x). If it still fails, check the exact name with git branch -r; names are case-sensitive on the remote even if your filesystem is not. Single-branch or shallow clones also only fetch one branch; use git fetch origin feature-x:feature-x.