rebase-current-branch
Skill này làm gì
Công cụ này cập nhật “branch” (một dòng công việc riêng) của bạn để có các thay đổi mới nhất từ nhánh chính của dự án. Nó làm việc này một cách an toàn, đảm bảo công việc của bạn không bị mất.
Khi nào nên dùng
- ✓Khi bạn muốn đưa các thay đổi mới nhất từ nhánh chính vào công việc của mình.
- ✓Trước khi nhờ người khác xem lại mã của bạn.
- ✓Khi bạn muốn hợp nhất công việc của mình với công việc của cả nhóm.
Liên kết skill
https://github.com/github/awesome-copilot/blob/main/skills/rebase-current-branch/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy cập nhật công việc của tôi với những thay đổi mới nhất từ nhánh chính.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ trước tiên kiểm tra công việc chưa lưu và hỏi bạn muốn làm gì. Sau đó, nó lấy các thay đổi mới nhất từ nhánh chính và áp dụng lên trên công việc của bạn, giữ mọi thứ có tổ chức.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Rebase the Current Branch
Update the active branch by replaying its commits on top of the latest default branch from its upstream remote. Use the repository's actual default branch, whether it is named main, master, or another branch.
Workflow
Inspect before changing anything. Run
git status --porcelain=v1 --branch --untracked-files=allandgit branch --show-current. Confirm the current branch is not the default branch and note any local changes. If the working tree has changes, stop and ask the user whether to commit, stash, or otherwise handle them. Do not stash automatically.Identify the upstream and default branch. Check
git remote -vandgit remote show <remote>(or the remote's symbolicHEAD) to determine the branch this repository treats as its default. Prefer the configured upstream for the current branch when available; otherwise useorigin. Do not assume thatmainexists or that a branch namedmasteris current. If the default branch cannot be identified unambiguously, ask the user.Fetch the latest default branch. Fetch only the identified remote and default branch, for example:
git fetch <remote> <default-branch>Verify the fetched remote-tracking ref exists before continuing.
Rebase the active branch. Tell the user which branch will be rebased onto which remote-tracking branch, then run:
git rebase <remote>/<default-branch>Handle conflicts without discarding work. If the rebase stops, explain which files conflict and that the rebase is paused. Resolve only when the intended changes are clear; otherwise ask the user. After resolution, stage the resolved files and run
git rebase --continue. If the user wants to abandon the operation, rungit rebase --abort. Never usegit reset --hard, discard user changes, or skip commits to force completion.Offer validation hooks. After the rebase succeeds, inspect the repository's documented validation steps and configured hooks (for example, pre-commit hooks or lint and test scripts). Ask the user whether they want those checks run before proceeding. If they agree, run the applicable checks and report their results; do not bypass or disable hooks.
Verify the result. When the rebase completes, run
git status --porcelain=v1 --branch --untracked-files=alland summarize the outcome, including the base branch used, validation results if run, and any remaining changes. Do not push, force-push, or amend commits unless the user separately asks.
Quick Path
For a clean working tree where the upstream default branch is known, the core operation is:
git fetch <remote> <default-branch>
git rebase <remote>/<default-branch>
Replace <default-branch> with the detected branch name (main, master, or another configured default). Never run the placeholder commands literally.
Safety Rules
- Preserve the user's current branch and uncommitted work.
- Do not rebase the default branch itself.
- Do not assume local
mainormasteris up to date; rebase onto the fetched remote-tracking branch. - Do not push or force-push as part of this workflow.
- If a rebase is already in progress, inspect its state and ask whether to continue or abort; do not start another rebase.
Câu hỏi thường gặp
“Branch” là gì?
Hãy coi “branch” là một bản sao của dự án, nơi bạn có thể làm việc mà không ảnh hưởng đến phiên bản chính. Nó giống như một bản nháp để chỉnh sửa.
“Rebase” nghĩa là gì?
“Rebase” giống như sắp xếp lại thứ tự công việc của bạn. Thay vì chỉ gộp, nó lấy các thay đổi của bạn và đặt chúng “lên trên” các cập nhật mới nhất, như thể bạn bắt đầu làm việc sau các cập nhật đó.
Nếu có xung đột thì sao?
Nếu công việc của bạn và các cập nhật ở nhánh chính cùng thay đổi một phần mã, sẽ xảy ra xung đột. Công cụ sẽ thông báo và nhờ bạn quyết định giữ phiên bản nào.
Chi tiết
Mô tả gốc của tác giả
Rebase the currently checked out feature branch onto the latest upstream default branch. Use when asked to update a branch with main or master, rebase the current branch onto the default branch, or sync a feature branch before review. Detects whether the repository uses main or master and guides safe conflict handling.
repo: github/awesome-copilot
Độ phổ biến
- Sao GitHub
- 40k
- Vị trí xếp hạng
- #7393
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
acquire-codebase-knowledge
40kGiúp agent của bạn hiểu và ghi tài liệu cho một dự án mã nguồn có sẵn. Hữu ích khi đón thành viên mới hoặc nắm tổng quan về kiến trúc.
acreadiness-assess
40kGiúp agent của bạn đánh giá mức độ sẵn sàng cho AI của dự án và tạo báo cáo. Hữu ích để biết dự án đã sẵn sàng dùng công cụ AI đến đâu.
acreadiness-generate-instructions
40kGiúp agent của bạn tạo hướng dẫn cho công cụ AI dựa trên kết quả đánh giá. Hữu ích để cải thiện cách AI làm việc với mã và khắc phục các khoảng trống.
acreadiness-policy
40kGiúp agent của bạn xác định hoặc áp dụng chính sách đánh giá dự án bằng AI. Hữu ích để chuẩn hóa cách đánh giá dự án và đảm bảo tuân thủ.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.