Home > Back-end >  List branches from one of the multiple remote repositories
List branches from one of the multiple remote repositories

Time:11-18

I have two remote reposotories and I want to list out the branches from one of the remote repositories only.

git branch -r shows only the branches from the origin .

CodePudding user response:

Try git remote show <name> where <name> is the name of the remote you want to get details for. git remote -v will give you a list of available remotes.

CodePudding user response:

git branch -r should give you the list of all remote branches (from both remotes), if you don't see branches from origin2, you probably haven't fetched changes from it :

git fetch origin2

To answer your "how to list branches from a specific remote ?" question :

  • branches from origin2 known to your local repo (update them by running git fetch origin2) :

    git branch -r --list "origin2/*"
    
  • branches you can access on the remote server :

    git ls-remote origin2 "refs/heads/*"
    
  • Related