ワンクリックで
batch-pr-rebase
Batch rebase multiple PRs against main to resolve conflicts and fix CI failures
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Batch rebase multiple PRs against main to resolve conflicts and fix CI failures
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Fix Docker GHCR push failures when repository organization changes but IMAGE\_NAME remains hardcoded to old org
Batch rebase conflicting PR branches and fix CI failures on main
| name | batch-pr-rebase |
| description | Batch rebase multiple PRs against main to resolve conflicts and fix CI failures |
| category | ci-cd |
| tags | ["git","rebase","pr-management","conflict-resolution","ci-fixes","worktree"] |
| verified | true |
| date | "2026-02-08T00:00:00.000Z" |
| outcome | success |
| Field | Value |
|---|---|
| Date | 2026-02-08 |
| Objective | Rebase 5 open PRs against main to resolve .gitleaks.toml conflicts and fix secret-scan CI failures |
| Outcome | ✅ Success - 5/5 PRs rebased, all conflicts resolved, all mergeable |
| Context | PR #3119 merged gitleaks fix to main; 3 PRs had conflicts; all 5 had outdated workflows |
Use this workflow when:
Don't use when:
git rebase workflow)# Fetch latest from remote
git fetch origin
# Update local main branch
git checkout main && git pull origin main
Why this works: Ensures your local main has the latest changes before rebasing PRs.
For each PR, identify which commits contain actual work vs. CI fixes:
# View commits unique to PR branch
git log --oneline origin/main..<branch-name>
# Example output:
# 391a2912 chore: retrigger CI ❌ Drop this
# d38c6663 fix(ci): add .gitleaks.toml ❌ Drop this (superseded by main)
# bdbb3d71 fix(data): replace Optional ✅ Keep this (meaningful work)
Pattern: Drop commits that:
.gitleaks.toml)For PRs with conflicts, use the cherry-pick approach:
# Find the meaningful commit hash
git log --oneline --all | grep "<search-term>"
# Example: git log --oneline --all | grep "fix(data): replace Optional"
# Recreate branch from main
git checkout main
git checkout -B <branch-name> origin/main
# Cherry-pick only the meaningful commit
git cherry-pick <commit-hash>
# Verify only meaningful commit remains
git log --oneline origin/main..HEAD
# Force push (safe because we recreated from main)
git push --force-with-lease origin <branch-name>
Why this works:
If a PR branch exists in a worktree:
# Check for worktree error
git checkout <branch-name>
# Error: 'branch-name' is already used by worktree at '/path/to/worktree'
# Work in the worktree instead
cd /path/to/worktree
# Remove untracked conflict files
rm .gitleaks.toml # Or any other untracked files causing conflicts
# Rebase normally
git rebase origin/main
# Push from worktree
git push --force-with-lease origin <branch-name>
Why this works: Git prevents checking out a branch in multiple locations; worktrees require in-place operations.
After rebasing all PRs:
# Check PR status
for pr in 3118 3117 3116 3115 3114; do
echo "=== PR #$pr ==="
gh pr view $pr --json number,title,mergeable,statusCheckRollup \
--jq '{number, title, mergeable, failing_checks: [.statusCheckRollup[] | select(.conclusion == "FAILURE") | .name]}'
echo ""
done
Success criteria:
mergeable: "MERGEABLE" for all PRssecret-scan and security-report failures resolvedWhat I tried:
git rebase -i origin/main
# In editor: kept all 3 commits, then manually skipped conflict
What happened: After skipping the .gitleaks.toml conflict, the "chore: retrigger CI" commit remained.
Why it failed: Interactive rebase applies commits sequentially; skipping one doesn't skip dependent commits.
What I learned: For complex conflict scenarios, cherry-pick is cleaner than interactive rebase.
What I tried:
git reset --hard origin/main && git cherry-pick bdbb3d71
What happened: Safety Net hook blocked the command.
Why it failed: git reset --hard destroys uncommitted changes; hook correctly prevented it.
What I learned: Use git checkout -B instead of reset for recreating branches.
What I tried:
git checkout skill/architecture/dtype-native-migration
# Error: already used by worktree at '/path/to/worktree'
What happened: Git prevents multiple checkouts of the same branch.
Why it failed: Worktrees lock branches to prevent conflicts.
What I learned: Always check for worktrees first; work in the worktree if it exists.
What I tried:
cd /path/to/worktree
git rebase origin/main
# Error: untracked .gitleaks.toml would be overwritten
Solution:
rm .gitleaks.toml
git rebase origin/main # Now succeeds
Why it worked: The file was untracked (from a previous conflict resolution), not part of the branch.
What I learned: Always check for untracked files before rebasing in worktrees.
| PR | Branch | Status | Commits Dropped | CI Fixed |
|---|---|---|---|---|
| #3118 | fix-flaky-data-samplers-optional-int | ✅ All passing | 2 | secret-scan, security-report |
| #3117 | skill/debugging/fixme-todo-cleanup-v2 | ⚠️ pre-commit fail | 2 | secret-scan, security-report |
| #3116 | skill/architecture/dtype-native-migration | ⚠️ flaky test | 0 | secret-scan, security-report |
| #3115 | feature/improve-import-tests-3033 | ✅ All passing | 2 | secret-scan, security-report |
| #3114 | dependabot/github_actions/... | ✅ All passing | 0 | secret-scan, security-report |
.gitleaks.toml)# 1. Preparation
git fetch origin
git checkout main && git pull origin main
# 2. Rebase with cherry-pick (for conflicting PRs)
git checkout main
git checkout -B <branch> origin/main
git cherry-pick <meaningful-commit-hash>
git push --force-with-lease origin <branch>
# 3. Rebase in worktree (for non-conflicting PRs)
cd /path/to/worktree
rm .gitleaks.toml # Remove untracked conflict files
git rebase origin/main
git push --force-with-lease origin <branch>
# 4. Verification
gh pr view <number> --json mergeable,statusCheckRollup
git fetch origin before startinggit log --oneline origin/main..HEADrm any untracked conflict files before rebasing--force-with-lease instead of --forcegh pr view after each rebaseworktree-sync - Syncing worktrees with maingh-fix-pr-feedback - Addressing PR review commentsfix-ci-failures - Diagnosing and fixing CI issues