本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)40k · #7393

rebase-current-branch

できること

このツールは、あなたの「ブランチ」(別に用意した作業の流れ)を、プロジェクトのメインブランチの最新の変更を取り込んだ状態に更新します。作業内容が失われないように安全に行われます。

使う場面

  • ✓メインブランチの最新の変更を自分の作業に取り込みたいとき。
  • ✓コードのレビューを依頼する前。
  • ✓チームの変更と自分の作業をマージしたいとき。

スキルのリンク

https://github.com/github/awesome-copilot/blob/main/skills/rebase-current-branch/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/github/awesome-copilot/blob/main/skills/rebase-current-branch/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“メインブランチの最新の変更を、私の作業に取り込んでください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

まず、保存されていない作業がないか確認し、どうするかを尋ねます。次に、メインブランチの最新の内容を取得し、あなたの作業の上に適用します。そのうえで、作業内容が整理された状態を保ちます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

  1. Inspect before changing anything. Run git status --porcelain=v1 --branch --untracked-files=all and git 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.

  2. Identify the upstream and default branch. Check git remote -v and git remote show <remote> (or the remote's symbolic HEAD) to determine the branch this repository treats as its default. Prefer the configured upstream for the current branch when available; otherwise use origin. Do not assume that main exists or that a branch named master is current. If the default branch cannot be identified unambiguously, ask the user.

  3. 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.

  4. Rebase the active branch. Tell the user which branch will be rebased onto which remote-tracking branch, then run:

    git rebase <remote>/<default-branch>
    
  5. 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, run git rebase --abort. Never use git reset --hard, discard user changes, or skip commits to force completion.

  6. 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.

  7. Verify the result. When the rebase completes, run git status --porcelain=v1 --branch --untracked-files=all and 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 main or master is 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.
よくある質問

「ブランチ」とは何ですか?

プロジェクトのコピーのようなものと考えてください。メインの版に影響を与えずに作業できます。変更を試すための下書きのようなものです。

「リベース」とはどういう意味ですか?

作業の順番を並べ替えることです。単純にマージするのではなく、あなたの変更を最新の更新の「上」に載せ直し、最新の更新のあとに作業を始めたかのようにします。

コンフリクトが起きたらどうなりますか?

あなたの作業とメインブランチの更新が、コードの同じ部分を変更している場合、コンフリクトが発生します。ツールがそれを知らせ、どちらの版を残すかの判断を手伝うよう求めます。

詳細

作者による元の説明

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

人気

GitHubのスター
40k
ランキング
#7393
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル