Doesn't show all remote branchs with git branch -r
Asked Answered
S

3

5

when I execute the command:

git branch -r, it's show just:

origin/HEAD -> origin/master
  origin/development-elton
  origin/master

And when execute the command:

git remote show origin, it's show:

 remote origin
  Fetch URL: [email protected]:r2a_/grconsig.git
  Push  URL: [email protected]:r2a_/grconsig.git
  HEAD branch: master
  Remote branches:
    caio-dev                   new (next fetch will store in remotes/origin)
    controle-usuario           new (next fetch will store in remotes/origin)
    development-elton tracked
    master                     tracked
    rails-admin                new (next fetch will store in remotes/origin)
    **refinancy            new (next fetch will store in remotes/origin)**

How make for pull the branch refinancy for my local?

Spoliate answered 1/3, 2016 at 20:56 Comment(0)
T
5

Expanding on mipadi's answer:

To see all remote branches (with a single remote):

git fetch
git branch -r

To see all remote branches (with multiple remotes):

git remote -v //shows names and URLs of remotes
git fetch --all
git branch -r
Texture answered 2/3, 2016 at 3:54 Comment(0)
G
17

If the existing answers are not sufficient, you can check your .git/config file. In my case, I had the following section:

[remote "origin"]
        url = https://github.com/John/project1
        fetch = +refs/heads/master:refs/remotes/origin/master

I've edited the file to:

[remote "origin"]
        url = https://github.com/John/project1
        fetch = +refs/heads/*:refs/remotes/origin/*

And then, I was able to fetch all branches with git fetch.

This happens sometimes, if you change the remote repository with:

git remote set-url origin  https://github.com/John/project1
Guadiana answered 3/10, 2017 at 12:43 Comment(2)
after adding [remote "origin"] I was able to git fetch --all my branches from Gitlab. Some explanations can be found here: gitguys.com/topics/…Ingrain
Thank you! This work, but how can I set this to default. It's create on every clone the wrong config!Verdie
T
5

Expanding on mipadi's answer:

To see all remote branches (with a single remote):

git fetch
git branch -r

To see all remote branches (with multiple remotes):

git remote -v //shows names and URLs of remotes
git fetch --all
git branch -r
Texture answered 2/3, 2016 at 3:54 Comment(0)
W
3

You need to run git fetch to get the latest branches.

Wergild answered 1/3, 2016 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.