Explore Courses Blog Tutorials Interview Questions
+2 votes
in DevOps and Agile by (29.3k 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 (50.2k 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

Browse Categories