Quantcast
Channel: How to check out a remote Git branch? - Stack Overflow
Viewing all articles
Browse latest Browse all 97

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

$
0
0

I tried many answers here but still couldn't checkout to a remote branch, turns out that when I first cloned the repo, I had added --single-branch flag which could be the reason why I was encountering the error when trying to create a new branch from a remote branch, to resolve this problem we can update the repository's configuration to fetch all branches from the remote repository:

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"git fetchgit branch -r

and now we can continue with

git checkout -b feature/FS origin/feature/FS

Viewing all articles
Browse latest Browse all 97

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>