fix(mq): push branch to origin before creating MR
CRITICAL FIX: Both `gt done` and `gt mq submit` were creating MR records without pushing the branch to origin first. When polecat worktrees were deleted, the unpushed branches were lost forever. This caused 12 MQ items to become orphaned - merge requests existed but their branches had vanished. The fix adds a mandatory `git push origin <branch>` before creating the MR record. If push fails, the MR is not created. Fixes: gt-aqku 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,14 @@ func runDone(cmd *cobra.Command, args []string) error {
|
||||
// Build title
|
||||
title := fmt.Sprintf("Merge: %s", issueID)
|
||||
|
||||
// CRITICAL: Push branch to origin BEFORE creating MR
|
||||
// Without this, the worktree can be deleted and the branch lost forever
|
||||
fmt.Printf("Pushing branch to origin...\n")
|
||||
if err := g.Push("origin", branch, false); err != nil {
|
||||
return fmt.Errorf("pushing branch to origin: %w", err)
|
||||
}
|
||||
fmt.Printf("%s Branch pushed to origin/%s\n", style.Bold.Render("✓"), branch)
|
||||
|
||||
// Build description with MR fields
|
||||
mrFields := &beads.MRFields{
|
||||
Branch: branch,
|
||||
|
||||
@@ -133,6 +133,14 @@ func runMqSubmit(cmd *cobra.Command, args []string) error {
|
||||
// Build title
|
||||
title := fmt.Sprintf("Merge: %s", issueID)
|
||||
|
||||
// CRITICAL: Push branch to origin BEFORE creating MR
|
||||
// Without this, the worktree can be deleted and the branch lost forever
|
||||
fmt.Printf("Pushing branch to origin...\n")
|
||||
if err := g.Push("origin", branch, false); err != nil {
|
||||
return fmt.Errorf("pushing branch to origin: %w", err)
|
||||
}
|
||||
fmt.Printf("%s Branch pushed to origin/%s\n", style.Bold.Render("✓"), branch)
|
||||
|
||||
// Build description with MR fields
|
||||
mrFields := &beads.MRFields{
|
||||
Branch: branch,
|
||||
|
||||
Reference in New Issue
Block a user