Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Stray `main` tag makes `git pull origin main` a silent no-op (tag shadows branch)

Abierto Apto para principiantes
#213 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
git, rust
Área
release

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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/tgrep

Todos los issues de microsoft/tgrep

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.