Como se describe en los comentarios: git remote add otherRepo …
solo configura el control remoto, no extrae nada de él. Tendrá que ejecutar git fetch otherRepo
para buscar las ramas del repositorio remoto antes de poder crear ramas locales basadas en ellas.
(respondiendo a hacer más comentarios por OP)
Si sólo desea hacer un seguimiento de una sola rama del repositorio remoto, puede volver a configurar su propiedad a distancia del fetch (remote.otherRepo.fetch
).
# done as a shell function to avoid repeating the repository and branch names
configure-single-branch-fetch() {
git config remote."$1".fetch +refs/heads/"$2":refs/remotes/"${1}/${2}"
}
configure-single-branch-fetch "$remoteName" "$branch"
# i.e. # configure-single-branch-fetch otherRepo master
Después de esto, git fetch otherRepo
sólo se ha podido recuperar la master
rama del repositorio remoto en el otherRepo/master
‘rama de seguimiento remoto’ en su repositorio local.
Para la limpieza de los otros 'seguimiento sucursales remotas', se podría eliminar a todos ellos y vuelva a recuperar simplemente el que usted desea, o se puede borrar de forma selectiva todos ellos, excepto solamente desde el que desea:
git for-each-ref --shell --format='git branch -dr %(refname:short)' refs/remotes/otherRepo | sh -nv
# remove the -nv if the commands look OK, then
git fetch otherRepo
# OR
git for-each-ref --shell --format='test %(refname:short) != otherRepo/master && git branch -dr %(refname:short)' refs/remotes/otherRepo | sh -nv
# remove the -nv if the commands look OK
Si decide que desea rastrear más de una rama remota, pero no todas, puede tener múltiples configuraciones de búsqueda (con git config --add remote."$remoteName".fetch …
o usando git config --edit
para duplicar y editar directamente la línea en el archivo de configuración de su repositorio).
Si también desea evitar la búsqueda de etiquetas desde el control remoto, configure la propiedad de control remoto de su control remoto (remote.otherRepo.tagopt
).
git config remote."$remoteName".tagopt --no-tags
# i.e. # git config remote.otherRepo.tagopt --no-tags
hizo usted 'git fetch otherRepo' antes de intentar expandirse? 'git remote add' simplemente configura el control remoto, no hace una búsqueda de forma automática. Si ya la ha buscado, ¿está seguro de que tiene una rama llamada maestro? 'git branch -r' o' git remote muestra -n otherRepo' (* después de recuperarlo *) para verificar qué ramas tiene. –
@crhis: gracias, ahora funciona. Parece lógico que necesite buscar, sin embargo, esto agrega, todas las otras ramas de otherRepo también. ¿Puedo obtener otroRepo/Master? No quiero desordenar la sucursal -r. –