rebase

작성자: openshift

현재 브랜치를 기본 브랜치 위로 리베이스하고, 모든 충돌을 해결한 뒤 린트, i18n, 빌드가 통과하는지 확인합니다. 사용자가 리베이스, 업데이트, 또는 동기화를 요청할 때 사용합니다…

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

Rebase

Rebase the current branch onto its base branch.

Step 1 — Determine the base branch

Read release-branches.md to get the list of branches. For each branch, compute the merge-base with HEAD and count the commits between them:

mb=$(git merge-base HEAD <branch>)
git rev-list --count "$mb"..HEAD

The base branch is whichever has the lowest commit count (fewest commits between the merge-base and HEAD). If counts are tied, prefer main.

Tell the user which base branch was detected before proceeding.

Step 2 — Check if base branch is up to date

Run git fetch upstream <base-branch> to update the remote tracking ref (this is read-only and does not change any local branches), then compare:

git fetch upstream <base-branch>
git rev-list --count <base-branch>..upstream/<base-branch>

If the count is 0, the local base branch is up to date — skip ahead to Step 3.

If the count is greater than 0, tell the user how many commits their local base branch is behind the remote and ask whether they want to pull. Do NOT pull without the user's consent.

  • If the user says yes, run git checkout <base-branch> && git merge --ff-only upstream/<base-branch> && git checkout - then continue to Step 3.
  • If the user says no (or to skip), continue to Step 3 using the local base branch as-is.

Step 3 — Rebase

Save the current commit hash before rebasing so it can be used for comparison later:

pre_rebase_head=$(git rev-parse HEAD)
git rebase <base-branch>

If the rebase completes cleanly, skip to Step 4.

Resolving conflicts

When conflicts occur, repeat this loop until the rebase finishes:

  1. Run git diff --name-only --diff-filter=U to list conflicting files.
  2. Read each conflicting file, examine the conflict markers (<<<<<<<, =======, >>>>>>>), and resolve them by keeping the correct version. Prefer incoming (base-branch) changes for dependency updates and lockfile entries; prefer the current branch's changes for feature code — but use judgment and the surrounding context to decide.
  3. Stage resolved files: git add <files>.
  4. Continue: git rebase --continue.
  5. If new conflicts appear, go back to substep 1.

Step 4 — Fix lint, i18n, and build

After the rebase succeeds, run the following commands in order, fixing any errors before moving on:

  1. npm run lint-fix — fix lint/formatting issues automatically.
  2. npm run i18n — regenerate locale files.
  3. Before building, check whether npm install needs to be run. Compare the current package-lock.json against the saved pre-rebase commit:
    git diff "$pre_rebase_head" -- package-lock.json
    
    If there are changes, run npm install before continuing.
  4. npm run build — ensure the project compiles.

If any step produces errors that lint-fix did not auto-resolve, fix them manually and re-run the failing command until it passes.

Step 5 — Report

Summarize what happened:

  • Which base branch was used
  • How many conflicts were resolved (and in which files)
  • Whether lint, i18n, and build passed cleanly or required fixes

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