2.5 KiB
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
- Resolve remote URL: Run
git remote get-url originto 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. - Run
git statusto check for uncommitted changes (staged or unstaged). - If there are uncommitted changes, run
git stash push -m "auto-stash before pull"to save them. - Run
git pull --rebaseto fetch and rebase onto the latest remote changes. - If the pull succeeds and changes were stashed, run
git stash popto restore them.- If
git stash popresults in conflicts, rungit diff --name-only --diff-filter=Uto 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>orgit checkout --theirs <file>followed bygit add <file>for each file as directed. - If the user chooses manual, leave the conflicts in place and let them resolve.
- If
- If the rebase fails due to conflicts:
- Run
git log --oneline --mergeor checkgit statusto identify which commit is being applied. - Run
git diff --name-only --diff-filter=Uto 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>orgit checkout --theirs <file>followed bygit add <file>, thengit rebase --continue - manual — leave the conflicts in place for the user to resolve
- skip — run
git rebase --skipto skip the conflicting commit entirely - abort — run
git rebase --abortto undo the rebase and restore the branch to its previous state
- ours / theirs — for each conflicting file, run
- Do NOT take any action without the user's explicit choice.
- Run
- Report the result to the user (success, or summary of any issues). Include any new commits pulled as remote links:
<remote-url>/commit/<hash>.