Git know the list of branches before cloning

727 Views Asked by At

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

There are 1 best solutions below

13
On

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