4

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: git@bitbucket.org:r2a_/grconsig.git
  Push  URL: git@bitbucket.org: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?

Elton Santos
  • 571
  • 6
  • 32

3 Answers3

15

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
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
  • after adding `[remote "origin"]` I was able to `git fetch --all` my branches from Gitlab. Some explanations can be found here: https://gitguys.com/topics/the-configuration-file-remote-section-git-config/ – viktorkho Dec 12 '19 at 13:11
  • Thank you! This work, but how can I set this to default. It's create on every clone the wrong config! – Burner Jul 02 '20 at 15:00
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
Osama AbuSitta
  • 3,918
  • 4
  • 35
  • 51
Nick Fox
  • 578
  • 3
  • 8
3

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

mipadi
  • 398,885
  • 90
  • 523
  • 479