Me pediste que tirara sin decirme con qué rama quieres fusionarte.
TL; DR: Tengo una rama "rastreada" que no puedo tirar.
Así que aquí estoy en "cubo-4":
$ git branch -v
bucket-1 410f7b5 * gh-53 * gh-48 * "Share App"
bucket-2 7ed70a2 * upgrade to SOLR 3.3.0
bucket-3 400ffe4 * emergency fix prod issue
* bucket-4 64c2414 Merge branch 'bucket-3' into bucket-4
master 8dc4854 [ahead 1] * gh-73
Me gustaría introducir cambios desde mi control remoto:
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.bucket-4.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "bucket-4"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
Hmm, extraño, pensé que ya había añadido "bucket-4" como una rama de seguimiento. Veamos:
$ git remote show origin
* remote origin
Fetch URL: [email protected]:abcd/main.git
Push URL: [email protected]:abcd/main.git
HEAD branch (remote HEAD is ambiguous, may be one of the following):
bucket-3
master
Remote branches:
bucket-1 tracked
bucket-2 tracked
bucket-3 tracked
bucket-4 tracked
master tracked
Local branches configured for 'git pull':
bucket-1 merges with remote bucket-1
bucket-2 merges with remote bucket-2
bucket-3 merges with remote bucket-3
master merges with remote master
Local refs configured for 'git push':
bucket-1 pushes to bucket-1 (up to date)
bucket-2 pushes to bucket-2 (up to date)
bucket-3 pushes to bucket-3 (up to date)
bucket-4 pushes to bucket-4 (local out of date)
master pushes to master (fast-forwardable)
De hecho, bucket-4 está marcado como "tracked", pero de alguna manera está configurado para push, pero no pull.
Mirando mi archivo .git/config
, veo que tengo entradas" remotas "y" fusionadas " para la mayoría de mis ramas, pero no para cubo-4. ¿Cómo es siquiera considerado "rastreado" sin esto?
[remote "origin"]
url = [email protected]:abcd/main.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "rel-2011-07-07"]
remote = origin
merge = refs/heads/rel-2011-07-07
[branch "bucket-1"]
remote = origin
merge = refs/heads/bucket-1
[branch "bucket-2"]
remote = origin
merge = refs/heads/bucket-2
[branch]
autosetupmerge = true
[branch "bucket-3"]
remote = origin
merge = refs/heads/bucket-3
Veo que la solución probable aquí es agregar remote/merge
entradas para bucket-4 en mi archivo de configuración. Pero, ¿cómo se considera "rastreado" sin esto? bucket - 4 se creó localmente, luego se envió al servidor desde este repositorio, por lo que sospecho que de alguna manera no configuré el seguimiento correctamente para esta rama.
¿Hay alguna configuración que pueda agregar para hacer que todas las ramas locales rastreen sus controles remotos correctamente en el futuro?
2 answers
Dice bucket-4 pushes to bucket-4
solo porque el valor predeterminado al empujar una rama es empujarla a una con un nombre coincidente en el control remoto. (Tenga en cuenta que este sigue siendo el valor predeterminado, incluso si la rama local está siguiendo una rama de seguimiento remoto y la rama de seguimiento remoto corresponde a una rama con un nombre diferente en el repositorio remoto.)
La forma más sencilla para establecer la asociación entre el bucket-4
y {[3] {} en[5]} es asegurarse de que la próxima vez que se pulse, se do:
git push -u origin bucket-4
Alternativamente, puedes hacer:
git branch --set-upstream-to origin/bucket-4
Para responder a un par de sus preguntas directamente:
¿Cómo es siquiera considerado "rastreado" sin esto?
En este caso no es - no es el seguimiento de la rama de seguimiento remoto en ningún sentido si no hay branch.bucket-4.merge
o branch.bucket-4.remote
en su configuración de git. La salida de git remote show origin
solo te muestra dónde se enviaría la rama por defecto.
¿Hay alguna configuración que pueda agregar ¿para hacer que todas las sucursales locales rastreen sus controles remotos correctamente en el futuro?
No creo que lo haya. Cuando creó bucket-4
localmente, como supongo que sucedió, la rama de seguimiento remoto no existía, por lo que no se puede configurar en ese momento, sería un comportamiento predeterminado muy confuso. Solo necesita recordar agregar -u
a su primer git push
de esa rama a su repositorio ascendente.
Espero que eso sea de alguna ayuda.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-28 12:03:47
git branch --set-upstream <branch> origin/<branch>
fue obsoleto al menos a partir de 1.8.2.3 (mi versión).
Use git branch --set-upstream-to=origin/<branch> <branch>
en su lugar.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-06 17:43:35