Fui enviado para um repositório remoto do Bitbucket e, recentemente, um colega enviou um novo ramo que ele criou para o mesmo repositório.
Estou tentando buscar as alterações que ele enviou.
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
$ git branch -r origem / mestre
Na interface da Web da Bitbucket, posso ver o ramo que ele criou. Como posso fazer isso?
Próxima tentativa:
$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
Se o ramo que ele criou se chama new_branch_b , devo esperar o seguinte?
$ git branch -r
origin/master
origin/new_branch_b
Terceira tentativa:
$ 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
Quarta tentativa:
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
Liguei para o controle remoto em bitbucketvez de origem (pelo menos é o que me lembro; configurei-o há um tempo)
Quinta tentativa:
Atualizei a configuração remota do Bitbucket conforme a resposta de kan :
$ git config -e
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
Para a maioria das pessoas, isso será chamado de origem:
[remote "origin"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
Mais tarde,
$ 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
.... e assim por diante.
Eu acho git fetch originque também funcionaria git remote update.
git fetch originfaz o trabalho #
refs/remotes/bitbucket/*em vez derefs/remotes/origin/*.