github / github/gh-stack

gh stack modify: modify fails when merged branches have been pruned

Open
#146 7 comments 23 reactions 0 assignees View on GitHub
bug topic: cli - modify
Dominant language
Go
Stars
1.5k
Forks
70
Avg merge
1d 8h
Merged PRs (30d)
7

Description

Looks like modify can't deal with pruned branches once they have been merged.

See below output:

```
➜ token-scanning-service git:(aerendel/fix-generic-secrets-metadata) gh stack modify
✗ failed to apply modifications: building snapshot: resolving branch SHAs: failed to run git: fatal: ambiguous argument 'aerendel/mixed-content-types1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
```

### Observed behavior:
The bottom of my stack has been merged and the branch pruned so it doesn't exist locally or remotely anymore (not unusual once a branch is merged), and all `gh stack modify` operations fail to save. Any operation will fail, wether it's renaming a branch, reorganizing, dropping a branch, etc.

### Repro:
1. Make a stack with 2 or 3 layers
2. Merge the first layer
3. Delete the first layer's branch locally (or just answer Yes to gh stack's prune prompt)
4. Run `gh stack modify` and try to save any modify operation

Contributor guide

Open the contributing guide

Research direction

Start at the gh stack modify flow and the snapshot step that resolves branch SHAs, then reproduce the issue by pruning the bottom branch of a two- or three-layer stack. Done means renaming, reorganizing, dropping, and other modify operations can save successfully after the merged branch is deleted locally and remotely.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.