MCP-OpenProject/.claude/commands/speckit.pull.md

2.5 KiB

description
Pull the latest changes from the remote using rebase, stashing local changes if needed, with interactive conflict resolution.

User Input

$ARGUMENTS

You MUST consider the user input before proceeding (if not empty).

Outline

  1. Resolve remote URL: Run git remote get-url origin to get the remote URL. All commit and branch references in this skill MUST use the remote URL format (e.g., <remote-url>/commit/<hash>). Never output bare hashes without the full remote link.
  2. Run git status to check for uncommitted changes (staged or unstaged).
  3. If there are uncommitted changes, run git stash push -m "auto-stash before pull" to save them.
  4. Run git pull --rebase to fetch and rebase onto the latest remote changes.
  5. If the pull succeeds and changes were stashed, run git stash pop to restore them.
    • If git stash pop results in conflicts, run git diff --name-only --diff-filter=U to list conflicting files.
    • Summarize which files have conflicts and notify the user.
    • Do NOT attempt to resolve conflicts or drop the stash automatically.
    • Ask the user which version to keep for each conflicting file:
      • ours (local changes)
      • theirs (remote changes)
      • manual (let the user resolve it themselves)
    • If the user chooses ours or theirs, run git checkout --ours <file> or git checkout --theirs <file> followed by git add <file> for each file as directed.
    • If the user chooses manual, leave the conflicts in place and let them resolve.
  6. If the rebase fails due to conflicts:
    • Run git log --oneline --merge or check git status to identify which commit is being applied.
    • Run git diff --name-only --diff-filter=U to list conflicting files.
    • Summarize the conflicting commit (hash + message) and which files have conflicts.
    • Present the user with these options:
      • ours / theirs — for each conflicting file, run git checkout --ours <file> or git checkout --theirs <file> followed by git add <file>, then git rebase --continue
      • manual — leave the conflicts in place for the user to resolve
      • skip — run git rebase --skip to skip the conflicting commit entirely
      • abort — run git rebase --abort to undo the rebase and restore the branch to its previous state
    • Do NOT take any action without the user's explicit choice.
  7. Report the result to the user (success, or summary of any issues). Include any new commits pulled as remote links: <remote-url>/commit/<hash>.