+2 votes
1 view
in Devops and Agile by (28.1k points)
edited by

I've tried git branch -r, but that only lists remote branches that I've tracked locally. How do I find the list of those that I haven't? (It doesn't matter to me whether the command lists all remote branches or only those that are untracked.)

1 Answer

+2 votes
by (48k points)

In most cases the below command will work: 

git branch -r

But for some git branch -r does not work. Then maybe you've modified the default refspec, so that git fetch and git remote update don't fetch all the remote branches.

 If git branch -r does not work try:

git ls-remote --heads <remote-name>

 Or you can check with this git command 

git config --get remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"

contains a wildcard (*), of course, means everything under that path.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !