Remote branch not showing up in “git branch -r”

I have been pushing to a remote bitbucket repo and recently a colleague has pushed a new branch he created to the same repo.

I'm trying to fetch the changes he uploaded.

 $ git branch -a  
 * master 
 localbranch1
 localbranch2
 remotes/origin/master

$ git branch -r origin/master

In the web ui for bitbucket I can see the branch he has made. Any help/advice/direction would be most appreciated. Thanks.

Any futher info you need just ask.

EDIT 1

$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
 * branch            HEAD       -> FETCH_HEAD

If the branch he created is called new_branch_b should I be expecting to see:

$ git branch -r    
origin/master 
origin/new_branch_b

EDIT 2

$ git remote update
Fetching bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
 * branch            HEAD       -> FETCH_HEAD


$ git branch -r
  origin/master

EDIT 3

[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git

I called the remote bitbucket rather than origin (at least that's what I recall, I set it up a while ago)

EDIT 4

I updated the bitbucket remote config as per kan's answer.

$ git config -e

[remote "bitbucket"]
    url = https://user@bitbucket.org/user/repo.git
    fetch = +refs/heads/*:refs/remotes/bitbucket/*

For most people it will be called origin

[remote "origin"]
    url = https://user@bitbucket.org/user/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*

Afterwards

$ git remote update

Fetching bitbucket
Password for 'https://user@bitbucket.org':
remote: Counting objects: 48, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 35 (delta 21), reused 0 (delta 0)
Unpacking objects: 100% (35/35), done.
From https://bitbucket.org/user/repo
 * [new branch]      branch_name1 -> origin/branch_name1
 * [new branch]      branch_name2    -> origin/branch_name2

.... and so on.

I think git fetch origin would also work for git remote update

Thanks to everyone who helped me with this problem.

Answers


The remote section specifies also fetch rules. You could add something like into it:

fetch = +refs/heads/*:refs/remotes/origin/*

to fetch all branches from the remote. (or replace origin by bitbucket).

Please read about it here: http://www.gitguys.com/topics/the-configuration-file-remote-section/


Update your remote if you still haven't done so:

$ git remote update
$ git branch -r

Need Your Help

Replace element and preserve attributes

jquery dom replacewith

The following almost works in replace all instances of span[data-type="yesno"] with lis, but I'd like to also preserve the attributes, classes, etc. Is there a way to carry over the attributes in the

iPhone iOS is there an open source side scrolling game I can take a look at?

iphone ios objective-c game-engine side-scroller

I'm thinking of building a simple side scrolling game where an airplane is flying forward at constant speed and the user controls up and down to avoid obstacles. Since I have 0 game development

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.