From 951527de4e27889bf20bf7e5541768077c0fff91 Mon Sep 17 00:00:00 2001 From: Brooke Hatton Date: Fri, 7 Jun 2024 20:51:45 +0100 Subject: [PATCH] feat: allow `stack prev` to move to the trunk of the stack --- cmd/av/stack_prev.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/av/stack_prev.go b/cmd/av/stack_prev.go index 9926afcd..70bf47a6 100644 --- a/cmd/av/stack_prev.go +++ b/cmd/av/stack_prev.go @@ -48,9 +48,11 @@ var stackPrevCmd = &cobra.Command{ return nil } branchToCheckout = previousBranches[0] + } else if len(args) == 0 && len(previousBranches) == 0 { + branchToCheckout, _ = meta.Trunk(tx, currentBranch) } else { if len(previousBranches) == 0 { - return errors.New("there is no previous branch") + return errors.New("there is no previous branches in the stack") } var n int = 1 if len(args) == 1 {