init writes branch.<name>.remote = '.', so submit reports a push that never happened

Abierto
#480 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
git, github, go
Área
cli, devtools

Línea de trabajo

Reproduce el escenario de worktree con gh stack init --base develop feature/a feature/b, inspecciona los valores resultantes de branch.*.remote con git config, luego ejecuta gh stack submit --auto y compara el resultado con git ls-remote --heads origin. Se considera terminado cuando init no crea un remote . inutilizable y submit no informa de éxito a menos que las ramas lleguen realmente al remote configurado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Environment

  • gh 2.96.0 (2026-07-02), gh-stack v0.0.4, git 2.46.1, macOS 26.6
  • Run inside a git worktree (GIT_DIR=.git/worktrees/<name>)
  • origin is the canonical repo name, not a rename

Summary

gh stack init wrote branch.<name>.remote = . into git config. . means this local repository, so the subsequent gh stack submit pushed nowhere, printed Pushing to ...., and still reported ✓ Pushed and synced 2 branches. The branches did not exist on origin.

This is the same failure as #461 and the same family as #472, but a different trigger. There the cause was a renamed repo; here it is the remote config that init itself wrote.

Repro

git worktree add ../wt -b feature/a
# ... commit on feature/a, then branch feature/b on top, commit
gh stack init --base develop feature/a feature/b
git config --get-regexp 'branch\.feature.*remote'

Observed:

branch.feature/a.remote .
branch.feature/b.remote .

Every other branch in the same repo that was not created by gh stack init has remote origin.

Then:

gh stack submit --auto
Checking stack state...
Pushing to ....
⚠ failed to create PR for feature/a: creating PR: GraphQL: Head sha can't be blank,
  Base sha can't be blank, No commits between develop and feature/a,
  Head ref must be a branch (createPullRequest)
✓ Pushed and synced 2 branches

git ls-remote --heads origin 'feature/*' returns nothing. The push never happened, but the last line says it did. The PR-creation error is a downstream symptom: GitHub cannot see a branch that was never pushed.

Workaround

git push origin feature/a feature/b
git branch --set-upstream-to=origin/feature/a feature/a
git branch --set-upstream-to=origin/feature/b feature/b

After that, gh stack submit prints Pushing to origin... and works correctly. The stack view and the GitHub-side stack were unaffected throughout.

Why it matters

The empty remote name renders as Pushing to ...., which reads as ordinary progress ellipsis rather than an empty value, so there is nothing on screen to notice. Combined with the unconditional ✓ Pushed and synced line, the command looks like it succeeded. I only caught it because PR creation happened to fail in the same run; on a stack where the PRs already exist, submit would report success and silently push nothing.

Given #461 and #472 report the same shape from different causes, the general fix may be for submit to verify the push landed rather than trusting it, and to refuse an empty or . remote outright.

Note

I have not isolated whether the worktree is required to reproduce. It may be related to #459, which reports that gh-stack ties local state to $GIT_DIR and that a worktree changes it.

Lenguaje dominante
Go
Estrellas
1.5k
Forks
73
Merge medio
1 d 8 h
PR fusionados (30 d)
7

Guía de contribución

Abrir la guía de contribución

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 github/gh-stack

Todos los issues de github/gh-stack

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.