error: pathspec did not match any file(s) known to git

Have you encoun­tered the fol­low­ing error while check­ing out a branch.

error: pathspec 'foo' did not match any file(s) known to git.

Solu­tion:

git fetch

It will syn­chro­nizes your local repos­i­tory with the remote repos­i­tory. Hence, if the branch exists on the remote you will be able to check out that branch with­out any errors.

You may also like...