-1

I am using that command to clone a branch of a repository but I don't know why it throws that error

git clone -b redux-basics https://github.com/mschwarzmueller/reactjs-redux-basics.git

why that command returns me that

fatal: Remote branch redux-basics not found in upstream origin

please tell me what should I do next

2 Answers2

2

If you simply browse to the URL you yourself supplied and use GitHub's web interface to find the names of branches, you will see that this repository does not have a branch named redux-basics.

It does have a branch named 01-redux-basics (listed in the "stale" section, last updated 5 years ago).

torek
  • 448,244
  • 59
  • 642
  • 775
0

You can find the list of available branches by using

git ls-remote --heads https://git.LINK_TO_REPO.git

which returns something like

46d0adaf08ef87d0aa840f9a4338d172bf931752    refs/heads/pilot/buildsplit
349502cbb72664c376b2392bdbe8179725a52012    refs/heads/testing/time
32670bd5f6014542d8f9f3854e5aebff5eb8dddf    refs/heads/testing/health

And if I want to clone e.g. the branch time, don't forget to discard the refs/heads/ part and use

git clone --single-branch -b testing/time https://git.LINK_TO_REPO.git

Note that simply using commit hash instead of name doesn't work.

Khashayar
  • 357
  • 3
  • 12