rebase

โดย openshift

รีเบสสาขาปัจจุบันไปยังสาขาหลัก แก้ไขข้อขัดแย้งทั้งหมด และตรวจสอบว่า lint, i18n และ build ผ่าน ใช้เมื่อผู้ใช้ขอให้รีเบส อัปเดต หรือซิงค์…

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

Skills เพิ่มเติมจาก openshift

openshift-docs
openshift
ค้นหาและอ่านเอกสารประกอบ OpenShift Container Platform ในรูปแบบ markdown ใช้เมื่อผู้ใช้ถามเกี่ยวกับฟีเจอร์ การกำหนดค่า การติดตั้ง… ของ OpenShift
triage-leaked-infra
openshift
ประเมินว่า AWS VPC หรือชุดโครงสร้างพื้นฐานจาก HyperShift CI ปลอดภัยที่จะลบหรือไม่ ใช้เมื่อผู้ใช้วาง cleanleaked output และถามว่า 'ลบอันนี้ได้ไหม?', 'มัน...
openshift-expert
openshift
ผู้เชี่ยวชาญด้านแพลตฟอร์ม OpenShift และ Kubernetes ที่มีความรู้เชิงลึกเกี่ยวกับสถาปัตยกรรมคลัสเตอร์ โอเปอเรเตอร์ เครือข่าย พื้นที่จัดเก็บข้อมูล การแก้ไขปัญหา และไปป์ไลน์ CI/CD ใช้…
Konflux Archived PipelineRuns
openshift
เข้าถึง Konflux PipelineRuns, TaskRuns และบันทึกพ็อดที่ถูกเก็บถาวรผ่าน KubeArchive ใช้โดยอัตโนมัติเมื่อตรวจสอบผลลัพธ์ของ Konflux PipelineRun หรือสืบสวน...
backport
openshift
ย้อนกลับคอมมิตหรือ PR จาก main ไปยัง release branch ใช้เมื่อผู้ใช้ขอให้ย้อนกลับ, cherry-pick, หรือพอร์ตการเปลี่ยนแปลงระหว่าง branch หรือเมื่อกำลังแก้ไข…
Build CPO Image
openshift
สร้างและพุชอิมเมจคอนเทนเนอร์ control-plane-operator ใช้โดยอัตโนมัติเมื่อทดสอบการเปลี่ยนแปลง CPO ที่ต้องปรับใช้กับคลัสเตอร์ที่ใช้งานจริง
find-complexity
openshift
ค้นหาฟังก์ชันและเมธอดที่มีความซับซ้อนของไซโคลเมติกสูง ความยาวมากเกินไป หรือมีพารามิเตอร์มากเกินไป ใช้เมื่อผู้ใช้ขอให้ค้นหาโค้ดที่ซับซ้อน ความซับซ้อน…
raise-pr
openshift
ขั้นตอนการทำงานทีละขั้นตอนสำหรับการคอมมิตการเปลี่ยนแปลงที่ staged และเปิด pull request ในรีโพซิทอรี lightspeed-service