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

Inserting a layer in the middle of a stack requires unstack + link, which permanently drops merged PRs

Abierto
#382 2 comentarios 18 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
github, go
Área
api, cli

Línea de trabajo

Empieza reproduciendo el comportamiento reportado de gh stack link y gh stack unstack; después inspecciona la limitación de REST PATCH /repos/{o}/{r}/pulls/{n} y el flujo existente de pertenencia al stack. Se considera terminado cuando una inserción en mitad del stack o una reconstrucción sin pérdidas conserva la pertenencia de los PR fusionados y mantiene intacto todo el historial del stack.

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

Descripción

feature request topic: cli - stack modification
Summary

There is no way to insert a layer in the middle of an already-submitted stack while keeping the stack's merged PRs as members. The only working procedure (unstack + link) moves the still-open PRs into a new stack and leaves every merged PR behind in the old one, which is then closed. The historical grouping of the stack is lost, permanently and irreversibly.

Current behavior

Given a submitted stack S with, bottom to top, one merged PR #1 and open PRs #2 → #3 → #4, and the need to insert a new layer between #2 and #3:

  1. gh stack modify is TUI-only, so it is unusable non-interactively (and it restructures the local stack, not the server-side membership of an existing PR).
  2. Retargeting the base of an existing stacked PR is refused:
    • REST PATCH /repos/{o}/{r}/pulls/{n}HTTP 422 … PullRequest.base is invalid
    • gh pr edit <n> --base <branch>Cannot change the base branch because the pull request is part of a stack
  3. gh stack link only appends to the top (gh stack link <stack#> <new>); it has no position/insert argument, and it rejects arguments that belong to a different stack.
  4. So the only way out is gh stack unstack <S> + gh stack link <bottom> … <top>. unstack (v0.1.0) unstacks the open PRs and leaves the merged #1 in S; S becomes open: false with #1 as its sole member, and #1 cannot be linked into the new stack (rejected as belonging to another stack).

Net effect: a purely structural edit in the middle of the stack silently destroys the association between the merged layers and the layers that are still in flight.

Expected behavior

Either of:

  • Insertion: a way to place a PR/branch at an arbitrary position of an existing stack, e.g. gh stack link --after <pr> / --before <pr> / --position <n>, without tearing the stack down.
  • Lossless rebuild: allow merged PRs to be re-linked into a stack (or have unstack + link carry them over), so the recovery procedure above at least preserves the full history of the stack.
Why it matters

Merged layers are exactly the part of a stack that documents why the remaining layers look the way they do. Keeping them attached is useful today when reading the stack, and it is what would let the web UI group a whole line of work — landed and in flight — under a single stack. Today, any mid-stack restructuring resets that grouping, so long-lived stacks progressively lose their own history.

Environment
  • gh stack version 0.1.0
  • Private repository, stacks enabled.
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.