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?

3 Answers 3

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
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/…
    – viktorkho
    Dec 12, 2019 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 2, 2020 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
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.