Rebase the current branch and its PR stack, or resolve conflicts if a rebase is already in progress.
Rebase the current branch and its PR stack, or resolve conflicts if a rebase is already in progress.
GIT_DIR=$(git rev-parse --git-dir) MODE=${ARGUMENTS:-$(test -d "$GIT_DIR/rebase-merge" -o -d "$GIT_DIR/rebase-apply" && echo "conflict" || echo "default")}
default → Default Rebase Modestack → Stack Rebase ModeResolve conflicts and complete an in-progress rebase.
git status. If no rebase in progress, abort with a message.rebase-merge/rebase-apply directory exists):
git diff --name-only --diff-filter=Ugit rebase --continue (may be a clean step)git rm if so<<<<<<<, =======, >>>>>>> markersgit add <files>git diff --checkgit rebase --continuegit push --force-with-lease gh repo view --json defaultBranchRef -q .defaultBranchRef.name
git branch --show-currentgit fetch origin <default_branch>git rebase origin/<default_branch> --autostashgit push --force-with-leaseWalk the PR chain and rebase each branch bottom-up.
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
git branch --show-currentghstack
ghstack is not available, walk the PR chain from HEAD toward the default branch:
gh pr view <branch> --json baseRefName -q .baseRefNamegh pr view fails (no open PR for branch): abort with error — "branch X has no open PR, cannot determine stack"git fetch origin <default_branch>git checkout <branch> — if local ref missing, git fetch origin <branch> && git checkout <branch>git rebase origin/<default_branch> --autostashgit rebase <prev_branch> --autostashgit push --force-with-leasegh pr edit <branch> --base <actual_base_branch>git checkout <original_branch>