I have gathered information about the current PR and git state. Here are the results:
<current_pr>
!gh pr view --json number,title,state,url,headRefName
</current_pr>
<current_branch>
!git rev-parse --abbrev-ref HEAD
</current_branch>
<git_status>
!git status --short
</git_status>
Instructions
Step 1: Verify PR is ready
- Check the PR state - ensure it's OPEN and ready to merge.
- Check for uncommitted changes - warn if there are local changes that might be lost.
Step 2: Merge the PR
- Merge with squash and delete the branch:
gh pr merge <number> --squash --delete-branch
Step 3: Switch to main
- Checkout main and pull latest:
git checkout main && git pull
Step 4: Create new branch
-
Ask the user for the new branch name using AskUserQuestion tool.
-
Create the branch:
git checkout -b <branch-name> -
Confirm the new branch was created with
git branch --show-current.