error: pathspec did not match any file(s) known to git
Have you encountered the following error while checking out a branch.
error: pathspec 'foo' did not match any file(s) known to git.
Solution:
git fetch
It will synchronizes your local repository with the remote repository. Hence, if the branch exists on the remote you will be able to check out that branch without any errors.