Skip to main content
skill GitHub Copilot official · GitHub

rebase-current-branch — GitHub Copilot skill: what it does

Rebases the active feature branch onto the latest upstream default branch. Useful when you need to sync changes from main or master before review without losing uncommitted work.

Install into GitHub Copilot · Skills CLI (Vercel) All methods and platforms ↓
npx skills add github/awesome-copilot --skill rebase-current-branch
Open on GitHub

What rebase-current-branch does

The skill rebases your current branch using Bash tools. It starts by running git status to inspect the working directory. If uncommitted changes exist, the workflow stops immediately and asks how to handle them. It will not stash work automatically.

Next, it detects the upstream remote and whether the default branch is named main, master, or something else. It fetches only that branch and runs git rebase. When merge conflicts occur, the skill stops. It never skips commits or runs git reset --hard. Instead, it identifies the affected files and asks you how to resolve them.

Once the rebase finishes, the agent offers to run configured project hooks and tests. It will not execute git push or force-push on its own. Install this skill if you want controlled branch synchronization without destructive Git shortcuts.

What it helps with

  • update a feature branch with incoming commits from main or master
  • avoid rebasing on top of dirty working directories
  • handle merge conflicts without skipping commits
  • run repository tests and pre-commit checks after rebasing

Example prompts for the agent

  • Rebase the current branch onto main
  • Update my branch with master
  • Sync this feature branch with upstream before review

How to install rebase-current-branch

1Skills CLI (Vercel)

npx skills add github/awesome-copilot --skill rebase-current-branch

2GitHub CLI

gh skill install github/awesome-copilot rebase-current-branch

3Manually: put the files in place

.github/skills/rebase-current-branch/SKILL.md

From the same set554

The whole set →
git-commit official github This skill reviews Git changes, stages related files, and creates Conventional Commits. Use it when you want an agent to make one commit or split work into separate commits. GitHub Copilot 47,165installs excalidraw-diagram-generator official github Turn a plain-language description into an Excalidraw diagram. Useful for mapping processes, system structure, and relationships between entities. GitHub Copilot 31,639installs multi-stage-dockerfile official github This skill guides GitHub Copilot in writing multi-stage Dockerfiles for different languages and frameworks. Use it when the final runtime image should contain fewer build dependencies. GitHub Copilot 29,688installs documentation-writer official github Skill that turns the agent into a technical writer following the Diátaxis framework: tutorials, how-to guides, reference, and explanation. Proposes structure before writing. GitHub Copilot 27,757installs prd official github Turns a feature idea into a structured PRD with user stories, technical requirements, and risks. Use it when planning a software feature or an AI-powered one. GitHub Copilot 24,035installs refactor official github This skill reshapes existing code without changing its external behavior. Use it for gradual cleanup of large functions, duplication, weak types, and code smells. GitHub Copilot 22,321installs java-springboot official github Gives GitHub Copilot Spring Boot development practices, from project layout to tests and security. Use it when writing or reviewing Java application code. GitHub Copilot 21,272installs create-readme official github This skill reviews a project and creates a structured README.md. Use it when the repository needs clear documentation based on its actual files and code. GitHub Copilot 19,081installs

Similar

track-findings official OpenAI This skill moves validated Codex Security findings into Linear, Jira, or GitHub. Use it when scan results are reviewed and ready for controlled tracking. CX Codex GP ChatGPT 26installs collab-proof dong7812 Separates Claude's actual contributions from developer actions in a coding session. Helps log architecture decisions and bug root causes directly into the repository. Claude Code 25installs copilot-sdk microsoft Builds programmatic applications using the GitHub Copilot SDK in Node.js, Python, Go, and .NET. Helps configure sessions, tools, and streaming. Claude Code GitHub Copilot 76installs github-issue-creator microsoft Converts voice notes, raw logs, and screenshots into structured GitHub-flavored markdown issue reports. Saves them directly to /issues/ in your repository. Claude Code GitHub Copilot 63installs ar-resume Alireza Rezvani Resumes a paused autoresearch experiment in Claude Code by checking out its git branch, loading previous metric logs, and preparing the next run. Claude Code 11installs triage Matt Pocock This skill moves issues and external PRs through triage states, verification, and agent briefs. It fits maintainers managing an issue queue. Claude Code 990,453installs code-review Matt Pocock Reviews changes from a chosen reference point against repository standards and the originating spec. Use it for a branch, PR, or work in progress. Claude Code 789,521installs implement Matt Pocock Implements work from a specification or tickets, following a test-driven flow and ending with review and a commit. Use it when a coding task needs a defined delivery routine. Claude Code 774,700installs

Questions about rebase-current-branch

How to install rebase-current-branch in GitHub Copilot?

Run gh skill install github/awesome-copilot rebase-current-branch or execute npx skills add github/awesome-copilot --skill rebase-current-branch.

What does the rebase-current-branch skill do?

It determines your upstream default branch, fetches new commits, and replays your current branch commits on top. If conflicts occur, it pauses the rebase for manual guidance.

Does this skill push changes after completing the rebase?

No. Safety rules explicitly forbid running git push or force-push without a separate instruction from the user.

Source text

SKILL.md · MIT
---
name: rebase-current-branch
description: '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.'
license: MIT
allowed-tools: Bash
---

# 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:

   ```sh
   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:

   ```sh
   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:

```sh
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.

© github · MIT · github/awesome-copilot

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor