skills/github-workflow/skills/gh-pr-update/SKILL.md
Update PR branch with latest changes from base branch
npx skillsauth add dtsong/my-claude-setup GitHub PR UpdateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
owner/repo format with alphanumeric characters and hyphens only.Update a pull request's branch with the latest changes from the base branch.
/gh-pr-update # Update current PR's branch
/gh-pr-update 123 # Update PR #123's branch
/gh-pr-update --rebase # Rebase instead of merge
/gh-pr-update --local # Update locally and push
Uses GitHub's API to update the branch without local checkout:
# Using gh CLI
gh pr update-branch $PR_NUM
# Using GitHub MCP
mcp__github__update_pull_request_branch(owner, repo, pr_number)
For more control or when API update isn't available:
# Switch to PR branch
git checkout feat/dark-mode
# Merge main into the branch
git merge origin/main
# Or rebase onto main
git rebase origin/main
# Push updated branch
git push origin feat/dark-mode
# Or force push if rebased
git push --force-with-lease origin feat/dark-mode
Updating PR #123 branch...
Before:
Branch: feat/dark-mode
Behind main by: 5 commits
Ahead of main by: 3 commits
Updating via GitHub...
After:
✓ Branch updated successfully
Behind main by: 0 commits
Ahead of main by: 8 commits (3 original + 5 merged)
New commits from main:
abc1234 Fix security vulnerability
def5678 Update dependencies
ghi9012 Performance improvements
jkl3456 Bug fix
mno7890 Documentation update
CI checks will re-run automatically.
Check status with: /gh-pr-status
Updating PR #123 branch locally...
Fetching origin/main...
Merging main into feat/dark-mode...
Merge complete! Pushed to origin.
Updated commits:
your-commit-1 Your changes
your-commit-2 More changes
merge-commit Merge branch 'main' into feat/dark-mode
Branch is now up to date with main.
PR #123 branch is already up to date with main.
No update needed.
Cannot auto-update PR #123 branch.
Reason: Merge conflicts detected
Conflicting files:
- src/components/Header.tsx
- src/api/auth.ts
To resolve:
1. Update locally:
git checkout feat/dark-mode
git merge origin/main
2. Resolve conflicts:
/git-conflicts
3. Push resolved branch:
/git-push
Or use rebase:
/gh-pr-update --rebase --local
Rebasing PR #123 onto main...
Rebasing 3 commits:
abc1234 Add theme component
def5678 Wire up context
ghi9012 Add styles
Rebase successful!
Note: Force push required (history rewritten)
Pushing with --force-with-lease...
Branch updated. CI will re-run.
Warning: Any local clones of this branch will need to reset:
git fetch origin
git reset --hard origin/feat/dark-mode
| Method | Pros | Cons | |--------|------|------| | Merge | Safe, no force push | Adds merge commit | | Rebase | Clean linear history | Requires force push |
Recommendation:
If base branch has protection requiring updates:
Branch protection requires update before merge.
Repository setting: "Require branches to be up to date"
Options:
/gh-pr-update # Update branch with main
/gh-pr-update --rebase # Rebase onto main
After update, CI will re-run (required for merge).
When rebasing requires force push:
Rebase complete. Force push needed.
Safety checks:
✓ No new commits on remote since last fetch
✓ Using --force-with-lease (safer)
⚠️ Will rewrite 3 commits
This is safe because:
- You're the only one working on this branch
- Or: All collaborators are aware
Proceed with force push? [y/n]
/gh-pr-status to check if update is needed/git-merge-main for local merge approach/git-rebase for local rebase approach/gh-pr-merge after update succeedsdevelopment
Use when planning implementation steps, deciding commit format, or structuring development approach. Provides brainstorm-plan-implement flow with conventional commits. Triggers on 'how should I approach this', 'commit format'.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.