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 ?
3 Answers
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 Comments
As mentioned above.
git branch -a will display all your branches.
Important:
git branch -a will indeed display the list of branches but those are the branched currently tracked under your .git folder. As a best practice you should update your .git folder before listing the branches.
The update is done using the git fetch --all --prune
The --all will update all the branches and tags.
The --prune will remove all the deleted branches.