Skip to content

Commit 9c8d2fb

Browse files
committed
block add to stack if all branches merged
1 parent d5305eb commit 9c8d2fb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

cmd/add.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ func runAdd(cfg *config.Config, args []string) error {
5757
return nil
5858
}
5959

60+
if s.IsFullyMerged() {
61+
cfg.Warningf("All branches in this stack have been merged")
62+
cfg.Printf("Consider creating a new stack with %s", cfg.ColorCyan("gh stack init"))
63+
return nil
64+
}
65+
6066
idx := s.IndexOf(currentBranch)
6167
if idx >= 0 && idx < len(s.Branches)-1 {
6268
cfg.Errorf("can only add branches on top of the stack; checkout the top branch %q first", s.Branches[len(s.Branches)-1].Branch)

0 commit comments

Comments
 (0)