He estado empujando a un repositorio remoto de Bitbucket y recientemente un colega ha empujado una nueva sucursal que creó al mismo repositorio.
Estoy tratando de recuperar los cambios que cargó.
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
$ git branch -r origin / master
En la interfaz de usuario web de Bitbucket puedo ver la rama que ha creado. ¿Cómo puedo hacer esto?
Siguiente intento:
$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
Si la rama que creó se llama new_branch_b, ¿ debería esperar ver lo siguiente?
$ git branch -r
origin/master
origin/new_branch_b
Tercer intento:
$ 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
Cuarto intento:
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
Llamé al control remoto en bitbucketlugar de al origen (al menos eso es lo que recuerdo; lo configuré hace un tiempo)
Quinto intento:
Actualicé la configuración remota de Bitbucket según la respuesta de kan :
$ git config -e
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
Para la mayoría de las personas se llamará origen:
[remote "origin"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
Después,
$ 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
.... y así.
Creo git fetch originque también funcionaría git remote update.
git fetch originhace el trabajo
refs/remotes/bitbucket/*lugar derefs/remotes/origin/*.