Search code examples
gitbranchgit-remote

How to list remote branch without web request?


i just want to list my local remote branches. but when i run git remote show origin, it needs to take a request to the server. How can i do ?


Solution

  • git branch -r will list all remote-tracking branches that exist in your local repository:

    $ git branch -r
      origin/HEAD -> origin/master
      origin/master
    

    You can also use the -a option to get all branches that exist in your local repository:

    $ git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master