Error: pathspec 'test-branch' did not match any file(s) known to git

1.4K    Asked by AadityaSrivastva in Salesforce , Asked on Feb 24, 2021


I am a new user of Git. I have forked a repository called Spoon-Knife (available for practicing forking with Git). Then, I cloned it locally by running

git clone https://github.com/rohinichoudhary/Spoon-Knife.git

This repository contains three branches, i.e.

  • master,

  • test-branch,

  • change-the-title.

When I run git branch, it only shows *master, not the remaining two branches. And when I run

git checkout test-branch

I get the following error:

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

Why is this happening? How can I solve this problem?


Your git branch can be settled just by a couple of basic commands. Follow the means given underneath.

    $ git remote update
$ git fetch
$ git checkout --track origin/test-branch


Your Answer

Interviews

Parent Categories