How to get all remote branches

In this article let’s discuss about How to get all remote branches. Let’s go through the following methods without any delay.

Method 1:

# track all remote branches:
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# update all local copies of remote branches
git fetch --all
# update all local tracking branches
git pull --all

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

git branch -r

Hope the above solution works.

Realted Posts : No sudo with docker