Skip to content

feat(gitlaunch): auto-create PR instead of printing the command#26

Merged
MCamner merged 2 commits into
mainfrom
feat/gitlaunch-auto-pr
Jul 2, 2026
Merged

feat(gitlaunch): auto-create PR instead of printing the command#26
MCamner merged 2 commits into
mainfrom
feat/gitlaunch-auto-pr

Conversation

@MCamner

@MCamner MCamner commented Jul 2, 2026

Copy link
Copy Markdown
Owner

What

Make the Git menu's protected-branch flow actually open the pull request instead of just printing the gh pr create command as a hint.

Why

When a push to a protected branch (main/master) is blocked, create_pr_branch_for_push already:

  1. creates an mq/<slug>-<timestamp> branch,
  2. pushes it,

…and then only echoed Next: gh pr create --base … --head … --fill, leaving the user to run it by hand. This finishes the flow inside the menu.

Changes

terminal/launchers/gitlaunch.shcreate_pr_branch_for_push:

  • After the branch is pushed, prompt Create the pull request now? [Y/n] and run gh pr create --base <base> --head <branch> --fill on confirm.
  • Fallbacks preserved: decline → prints the manual command; gh pr create fails → prints the manual command and returns non-zero; gh not installed → prints the manual command (previous behavior). No path ends worse off than before.

Verification

  • bash -n gitlaunch.sh parses clean
  • Isolated simulation of the confirm branch confirms the Y path invokes gh pr create with the correct --base/--head args
  • Reuses the existing read … </dev/tty + confirm convention already used elsewhere in the function

🤖 Generated with Claude Code

MCamner and others added 2 commits July 2, 2026 15:06
create_pr_branch_for_push already creates and pushes the PR branch when a
protected branch blocks a direct push, but it only printed the suggested
`gh pr create` command as a "Next:" hint, leaving the user to run it by hand.

Run `gh pr create --base <base> --head <branch> --fill` directly after a
Y/n confirmation, so the whole protected-branch → PR flow completes inside
the Git menu. Falls back to printing the manual command when gh is missing
or PR creation fails, so no path regresses to a worse state than before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MCamner MCamner merged commit ca1f374 into main Jul 2, 2026
2 checks passed
@MCamner MCamner deleted the feat/gitlaunch-auto-pr branch July 2, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant