From 6d4e0f0c96952b264e1afb248b0cfc4d06a408f5 Mon Sep 17 00:00:00 2001 From: gastown/polecats/furiosa Date: Tue, 30 Dec 2025 20:52:52 -0800 Subject: [PATCH] gt done: Require pushed branch before MR creation (gt-bca67) Add BranchPushedToRemote check before creating MR bead. Prevents work loss when polecat is nuked with unpushed commits. --- internal/cmd/done.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/cmd/done.go b/internal/cmd/done.go index 9db409c1..2724fa0d 100644 --- a/internal/cmd/done.go +++ b/internal/cmd/done.go @@ -115,6 +115,16 @@ func runDone(cmd *cobra.Command, args []string) error { return fmt.Errorf("cannot submit main/master branch to merge queue") } + // Check for unpushed commits - branch must be pushed before MR creation + // Use BranchPushedToRemote which handles polecat branches without upstream tracking + pushed, unpushedCount, err := g.BranchPushedToRemote(branch, "origin") + if err != nil { + return fmt.Errorf("checking if branch is pushed: %w", err) + } + if !pushed { + return fmt.Errorf("branch has %d unpushed commit(s); run 'git push -u origin %s' first", unpushedCount, branch) + } + if issueID == "" { return fmt.Errorf("cannot determine source issue from branch '%s'; use --issue to specify", branch) }