Git List Remote Branches

Git List Remote Branches

Stewart Nguyen Feb-06, 2022 Dec-21, 2021 Git Git Remote

This article will introduce how to list remote repositories from your local branch.

Remote repositories are projects hosted on the server, such as Github/Gitlab.

git remote allows us to use a short name (alias) to execute commands instead of typing a whole remote URL.

$ git fetch git@github.com:stwarts/git-demo.git
From github.com:stwarts/git-demo
 * branch            HEAD       -> FETCH_HEAD

Use git remote -v for listing detail of all remotes, to display just the names, use git remote.

The -v option stands for --verbose, which shows the corresponding URL to each name.

$ git remote
origin
$ git remote -v
origin git@github.com:stwarts/git-demo.git (fetch)
origin git@github.com:stwarts/git-demo.git (push)

Related Article - Git Remote

  • Git Remote Add SSH
  • Remove Upstream Repository in Git
  • Create a Remote Repository From a Local Repository in Git
  • Synchronize a Local Repository With a Remote Repository in Git
  • Update a Repository by Setting Up a Remote
  • Push From an Existing Remote Repository to a Different Remote Repository in Git