Stray `main` tag makes `git pull origin main` a silent no-op (tag shadows branch)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 65/100
Línea de trabajo
El issue identifica el tag main creado por accidente e indica el comando propuesto para eliminarlo: git push origin :refs/tags/main. Revisa la lista de tags del repositorio y confirma que el tag main es el descrito; después, elimínalo. Comprueba que git fetch --dry-run origin main resuelva a la rama después.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
refs/tags/main (lightweight, → 0b3b528, #44) coexists with refs/heads/main. Git resolves an unqualified refspec by matching refs/tags/<name> before refs/heads/<name> (count_refspec_match() in remote.c), so the very common
git pull origin main
fetches the tag instead of the branch, then merges/rebases onto the tag's old commit. The command still exits 0, so the failure is silent: the checkout never updates.
Reproduction (against 0be7a76)
$ git fetch --dry-run origin main
* tag main -> FETCH_HEAD # expected: branch
$ git pull --rebase origin main
* tag main -> FETCH_HEAD
Already up to date. # exit 0, branch unchanged
A fully qualified refspec behaves correctly:
$ git fetch --dry-run origin refs/heads/main
* branch main -> FETCH_HEAD
Impact
Every client that passes the short branch name to git pull — GUI clients such as UGit do exactly git pull --recurse-submodules origin main, and so do many scripts — silently stops receiving updates. Worse, with pull.rebase=true the local branch can be moved backwards to 0b3b528: rebasing onto an ancestor of HEAD is reported as "already up to date", so the commits above it are dropped from the branch.
We hit precisely this: local main was rewound one commit, and three consecutive pull attempts returned success without applying the ~105 upstream commits. git fetch without a refspec was equally stale, because the branch half of the pull never ran.
git pull with no arguments is unaffected (it resolves branch.<name>.merge rather than matching a remote ref by name), which makes the problem easy to misdiagnose.
Suggested fix
Delete the stray tag — every other tag in this repository follows v*, so main looks accidental:
git push origin :refs/tags/main
(or Releases → Tags → main → Delete in the GitHub UI).
Workaround for affected clients until then
git pull --rebase origin refs/heads/main
Reproduced with git 2.45.2.windows.1 on Windows.
- Lenguaje dominante
- Rust
- Estrellas
- 3.5k
- Forks
- 140
- Merge medio
- 15 h 32 min
- PR fusionados (30 d)
- 27
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/tgrep
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/tgrep
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
chrisdickinson/trivia#26 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100