Back to list
troydai

merge-pr

by troydai

A git worktree management CLI

3🍴 0📅 Jan 24, 2026

SKILL.md


name: merge-pr description: Merge a GitHub PR and clean up the worktree. Use when merging a PR from a feature branch worktree that meets merging criteria.

Merge PR Skill

This skill handles the complete workflow for merging a GitHub PR when working in a gwt-managed worktree. It coordinates the merge, worktree cleanup, and branch synchronization.

When to Use

Use this skill when:

  • The user asks to merge a GitHub PR
  • You are currently in a feature branch worktree (not the main/home repository)
  • The PR has been approved and meets merging criteria

Why This Skill Exists

When working in a gwt worktree, the standard gh pr merge -sd command is insufficient because:

  • The -d flag cannot delete the local branch while it's checked out in the current worktree
  • The worktree directory cannot be removed while you're inside it
  • Manual coordination is required to clean up properly

Workflow Steps

Step 1: Pre-merge Checks

Verify the current state and PR readiness:

# Check current branch and worktree
gwt current

# Check PR status - ensure it's ready to merge
gh pr view

STOP and ask for instructions if:

  • You are in the home repository (not a feature worktree)
  • There are uncommitted changes (git status shows modifications)
  • The PR is not ready to merge (failed checks, missing approvals, etc.)

Step 2: Merge the PR

Merge with squash (do not delete branches yet):

gh pr merge -s

Once the merge succeeds, proceed with cleanup.

Step 3: Remove Worktree and Switch Home

Remove the current worktree and switch back to home:

gwt rm --this -y

Error Handling

If gh pr merge fails:

  • Check PR status with gh pr view
  • Verify CI checks have passed
  • Ensure PR has required approvals
  • Do NOT proceed with cleanup steps

If gwt rm --this fails:

  • Check for uncommitted changes
  • Verify the worktree state with gwt ls
  • Ask user for instructions before attempting manual cleanup

Important Notes

  • Always verify the PR is ready to merge before starting
  • Never force-delete branches with unmerged changes
  • If any step fails unexpectedly, stop and ask for user guidance
  • This workflow assumes a squash merge strategy; adjust if using merge commits or rebase

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon