Skip to content

Commit

Permalink
updated to checkout parent branch instead of switch to detached HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Konboi committed May 8, 2024
1 parent 50d63e0 commit fd19eb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/actions/sync_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ func SyncStack(ctx context.Context,
" - deleting merged branch ", colors.UserInput(currentBranch),
"\n",
)
if _, err := repo.Git("switch", "--detach"); err != nil {
return errors.Errorf("cannot switch to detached HEAD: %v", err)

if _, err := repo.CheckoutBranch(&git.CheckoutBranch{Name: br.Parent.Name}); err != nil {
return errors.Errorf("cannot checkout to parent branch %s: %v", br.Parent.Name, err)
}
if _, err := repo.Git("branch", "-D", currentBranch); err != nil {
return errors.Errorf("cannot delete merged branch %q: %v", currentBranch, err)
Expand Down

0 comments on commit fd19eb9

Please sign in to comment.