name: pr description: Create or update GitHub pull requests using gh CLI. Use when creating PRs, updating PR titles/descriptions, opening pull requests, or submitting changes for review.
Pull Request Management
Quick Start
-
Check authentication: If
ghcommands fail, unsetGITHUB_TOKEN:unset GITHUB_TOKEN -
Review changes: Analyze git diff, not commit messages:
git diff develop...HEAD -
Create or update PR (use temp file for description to avoid bash syntax issues):
# Write description to temp file echo "Description content" > /tmp/pr-body.txt # Create new PR gh pr create --base develop --title "Title" --body-file /tmp/pr-body.txt # Update existing PR gh pr edit --title "New title" --body-file /tmp/pr-body.txt
Workflow
- Check if PR exists:
gh pr view - Review code changes:
git diff develop...HEAD - Write description to temp file:
echo "..." > /tmp/pr-body.txt - Write title/description based on changes, not commit history
- Create new PR or update existing one targeting
developusing--body-file - If auth fails, unset
GITHUB_TOKENand retry
Commands
- Create: Write description to temp file, then
gh pr create --base develop --title "..." --body-file /tmp/pr-body.txt - Update: Write description to temp file, then
gh pr edit --title "..." --body-file /tmp/pr-body.txt - View:
gh pr view(check if PR exists) - List:
gh pr list(find PR number)
Always use --body-file instead of --body to avoid bash syntax issues in descriptions.
Best Practices
- Base branch: Always
develop - Review scope: Focus on code diff, ignore commit messages
- Update existing: Check for PR first, update if exists
- Authentication: Unset
GITHUB_TOKENifghauth fails