rebase-clean

작성자: openshift

Performs a strict clean rebase of a feature branch onto main with minimal conflict resolution and full validation. Use when the user asks to rebase carefully,…

npx skills add https://github.com/openshift/lightspeed-service --skill rebase-clean

Clean Rebase Workflow

Use this workflow exactly for rebases in this repository.

Rules

  • Do not create extra temporary branches unless the user explicitly asks.
  • Do not make unrelated edits.
  • Do not stop after analysis; finish rebase and validation.
  • Keep output brief and operational.
  • Never assume target branch names; detect current branch first.

Step 0: Detect Branch Context

  1. Run git branch --show-current.
  2. Treat detected current branch as the candidate target branch.
  3. Ask user to confirm explicitly before proceeding:
    • I detected '<current-branch>' as the current branch. Should I rebase this branch?
  4. If user specified a target branch, verify it matches current branch; if not, stop and ask.
  5. Do not run reset/rebase commands until this confirmation is received.
  6. Before any reset/rebase command, restate:
    • current branch
    • target branch
    • approved baseline ref and confirm when there is any mismatch or ambiguity.

Step 1: Restore Branch Baseline (Rerun Only)

Use this step only when a prior rebase attempt failed or introduced unwanted edits. For a first rebase attempt, skip this step and go directly to Step 2.

  1. Checkout target branch.
  2. Hard reset to the known backup/base commit the user approved.
  3. Fetch origin.

Command pattern:

git checkout <branch>
git reset --hard <backup-or-approved-base>
git fetch origin

Step 2: Rebase Onto Main

Run:

git rebase origin/main

If conflicts occur, resolve only the conflicted files. Do not add extra refactors.

Step 3: Conflict Resolution Policy

For each conflicted file:

  1. Start from one side (ours or theirs) as a temporary base.
  2. Apply only minimal compatibility changes required to compile and run tests on the new base branch.
  3. Keep behavior from the feature commit unless it is incompatible with upstream removals/renames.
  4. Resolve matching tests together with production code changes.
  5. Avoid opportunistic refactors during conflict resolution.

Then:

git add <resolved files>
GIT_EDITOR=true git rebase --continue

Repeat until rebase completes.

Step 4: Verify No Code Loss

Run these checks against the approved pre-rebase baseline (backup/base commit):

git range-diff origin/main...<approved-base> origin/main...HEAD
git diff --name-status <approved-base>..HEAD
git merge-base --is-ancestor origin/main HEAD
git log --left-right --cherry-pick --oneline origin/main...HEAD

Acceptance criteria:

  1. Branch intent is preserved:
    • Commit intent maps cleanly in range-diff (rewritten SHAs are fine).
  2. Main is fully incorporated:
    • git merge-base --is-ancestor origin/main HEAD succeeds (exit code 0).
  3. No unexpected file removals/renames beyond what upstream already changed.
  4. Any conflict-touched files have expected compatibility-only deltas.
  5. No unexplained drift from the approved baseline.

If any check fails, treat as code-loss risk and restart from Step 1.

Step 5: Full Validation Pipeline

Run exactly:

make test-unit && make test-integration && make verify

If validation or code-loss checks fail at any point:

  1. Treat it as an incorrect rebase result.
  2. Abort/restore to the approved baseline.
  3. Re-run the rebase/conflict-resolution flow from Step 1.
  4. Re-run Step 4 and this step.
  5. Repeat full loop until all checks pass.

Step 6: Final Report

Report only:

  • Rebase completed (yes/no)
  • Current branch and ahead/behind state
  • make test-unit result
  • make test-integration result
  • make verify result

Do not include unrelated diagnostics.

openshift의 다른 스킬

openshift-expert
openshift
OpenShift 플랫폼 및 Kubernetes 전문가로, 클러스터 아키텍처, 오퍼레이터, 네트워킹, 스토리지, 문제 해결 및 CI/CD 파이프라인에 대한 깊은 지식을 보유하고 있습니다. 사용…
official
find-token
openshift
숨겨진 인증 토큰을 찾습니다. find-token 스크립트를 실행하여 고유 토큰을 검색하세요.
official
code-review
openshift
풀 리퀘스트의 코드 품질, 정확성, 프로젝트 규칙을 검토합니다. 사용자가 PR 검토, 코드 리뷰, 또는 변경 사항 확인을 요청할 때 사용하세요.
official
css-review
openshift
CSS 코딩 스타일, PatternFly 토큰 사용, 모범 사례를 검토합니다. 사용자가 CSS 검토, 스타일 확인, 또는 CSS 파일 감사를 요청할 때 사용하세요.
official
review-readmes
openshift
리포지토리의 모든 README.md 파일을 검토하여 오타, 오류, 오래된 정보를 찾습니다. 사용자가 README 검토, 문서 정확성 확인 등을 요청할 때 사용합니다.
official
review-skills
openshift
프로젝트 AI 스킬의 중복, 오래된 참조, 오류 및 구조적 문제를 검토합니다. 사용자가 스킬 검토, 스킬 감사, 확인 등을 요청할 때 사용하세요.
official
test
openshift
태그로 필터링된 종단 간 테스트를 실행합니다. 사용자가 테스트 실행, Playwright 실행, 또는 @core나 @attach 같은 특정 기능 태그를 테스트하도록 요청할 때 사용하세요.
official
unused-exports
openshift
다른 파일에서 가져오지 않은 내보낸 심볼을 찾습니다. 사용자가 "내보내기 확인", "사용되지 않는 내보내기"라고 말하거나 내보내기를 정리하도록 요청할 때 사용하세요.
official