with one click
rebase
// Use when rebasing the current branch onto main or another base. Auto-detects base, handles conflicts, supports squashing. Triggers: rebase, sync with main, clean history before PR.
// Use when rebasing the current branch onto main or another base. Auto-detects base, handles conflicts, supports squashing. Triggers: rebase, sync with main, clean history before PR.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | rebase |
| description | Use when rebasing the current branch onto main or another base. Auto-detects base, handles conflicts, supports squashing. Triggers: rebase, sync with main, clean history before PR. |
Rebase the current branch onto the base branch. Handle conflicts gracefully.
These commands run automatically when the skill loads — output replaces each line below:
gh pr view --json baseRefName -q '.baseRefName' 2>/dev/null || truegit rev-parse --verify origin/main 2>/dev/null && echo origin/main || truegit rev-parse --verify origin/master 2>/dev/null && echo origin/master || truegit statusgit branch --show-currentls -d .git/rebase-merge .git/rebase-apply 2>/dev/null || truePick <base> from the pre-run output:
gh pr view returned oneorigin/main if it existsorigin/mastergit status: if uncommitted changes, STOP. Ask the user to commit or stash first.ls .git/rebase-* returned a path, an in-progress rebase exists. Ask the user if they want to --continue, --abort, or --skip.git fetch origin <base>
git log origin/<base>..HEAD --oneline — commits on this branchgit log HEAD..origin/<base> --oneline — new commits on base since divergencegit diff --stat origin/<base>..HEAD — summary of branch changesgit diff --name-only origin/<base>..HEAD — files changed on branchgit diff --name-only HEAD..origin/<base> — files changed on base<list>"Present to the user:
Wait for confirmation.
git rebase origin/<base>
Do NOT use the -i flag — interactive mode requires terminal input that is not available in agent contexts.
If the rebase stops with conflicts:
git status to identify conflicted filesgit add <resolved-file>git rebase --continueIf conflicts are too complex to resolve confidently: git rebase --abort and report to the user.
Since -i is unavailable, use the soft-reset pattern:
git rebase origin/<base>
git reset --soft origin/<base>
git commit -m "$(cat <<'EOF'
type(scope): combined commit message
Body summarizing all squashed changes.
EOF
)"
git log --oneline -10 to show the new historygit diff --stat origin/<base>..HEAD to confirm changes are preserved<base>. Branch is now up to date.".git/rebase-merge or .git/rebase-apply. Ask user: continue, abort, or skip.