Quantcast
Channel: How do I check out a remote Git branch? - Stack Overflow
Viewing all articles
Browse latest Browse all 49

Answer by alisa for How do I check out a remote Git branch?

$
0
0

I was stuck in a situation seeing error: pathspec 'desired-branch' did not match any file(s) known to git. for all of the suggestions above. I'm on git version 1.8.3.1.

So this worked for me:

git fetch origin desired-branch
git checkout -b desired-branch FETCH_HEAD

The explanation behind is that I've noticed that when fetching the remote branch, it was fetched to FETCH_HEAD:

$ git fetch origin desired-branch
From github.com:MYTEAM/my-repo
    * branch            desired-branch -> FETCH_HEAD

Viewing all articles
Browse latest Browse all 49

Trending Articles