This tutorial will help you to list all branches available on remote git repository. It is helpful you to find names of branches, which has been created on remote repository by someone and you want to checkout this on your local repository.
Option 1:
Firstly run
git fetch command to update your remote-tracking branches under refs/remotes/<remote_name>/.
$ git fetch
Now use following command to list all branches on local and all remote repositories.
$ git branch -a //output * development master staging remotes/origin/development remotes/origin/master remotes/origin/staging
Option 2:
You can also use ls-remote option to list remote repositories without updating your remote-tracking branches.
$ git ls-remote //output 5ffcb8136c48423f858e49c2df78fc7ac419fe39 HEAD 5ffcb8136c48423f858e49c2df78fc7ac419fe39 refs/heads/development 5ffcb8136c48423f858e49c2df78fc7ac419fe39 refs/heads/master 5ffcb8136c48423f858e49c2df78fc7ac419fe39 refs/heads/staging
If repository connected with multiple remotes, use following command syntax.
$ git ls-remote --heads <remote_name>
Thanks for Visit Here
Comments
Post a Comment