0

Is there a way to know the list of branches a repository has before cloning?

I tried the following command, but it doesn't seem to work for me:

git ls-remote [email protected]:Username/project.git

Edit solution:

git ls-remote http://www.github.com/Shopify/react-native-skia --h --sort origin "refs/heads/*"

1
  • 2
    What does "doesn't seem to work" mean? Commented Apr 15, 2022 at 12:03

1 Answer 1

3

In a single line, locally, git ls-remote /url/of/the/upstream/repo should list the remote HEADs and their associated branches without cloning anything.

For example, if you wanted to see the branches of Shopify/react-native-skia you would run git ls-remote https://github.com/Shopify/react-native-skia.git which should return branches of /Shopify/react-native-skia

13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.