Agent skill

Rebase

by opsmill in opsmill/infrahub

Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward.

Apache-2.0Auto-check passedDevelopment

Install Rebase

skills CLI
$ npx skills add opsmill/infrahub --skill rebase -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install opsmill/infrahub rebase --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/opsmill/infrahub.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rebase .claude/skills/rebase && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rebase
GitHub stars
529
Token cost
~2.3k tokens
SKILL.md length
1,123 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward.

  • Works in 5 steps: Assess Current State → Update Base Branch & Rebase → Resolve Merge Conflicts → …
  • : the user wants to rebase a feature branch
  • SKILL.md covers Introduction, Arguments, Main Tasks and Notes, plus 2 more sections
  • Calls git and gh

What it does

Rebase is an agent skill from opsmill/infrahub. Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward. TRIGGER when: the user wants to rebase a feature branch, update a branch against its base, or replay local work on top of the latest upstream. DO NOT TRIGGER when: merging a release branch into dev → merging-branches; only watching CI on an already-open PR → monitoring-pull-requests.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Requires a Git working tree. CI monitoring requires GitHub access (gh CLI authenticated, GitHub MCP server, or equivalent).

It sits in Development, covering Git workflow and Pull requests. The repository describes itself as: Infrahub is a graph-based data management platform with built-in version control, CI workflows, peer review, and API access. It’s purpose-built to power reliable infrastructure… The licence is Apache-2.0.

When your agent uses it

  • : the user wants to rebase a feature branch
  • Update a branch against its base
  • Replay local work on top of the latest upstream
  • : merging a release branch into dev → merging-branches

Example prompts

  • “Use the rebase skill to rebase a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally…”
  • “/rebase”

Requirements

  • Compatibility (from SKILL.md): Requires a Git working tree. CI monitoring requires GitHub access (gh CLI authenticated, GitHub MCP server, or equivalent).

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Assess Current State
  2. Update Base Branch & Rebase
  3. Resolve Merge Conflicts
  4. Verify Rebase Result
  5. Force Push & Monitor CI (only when push argument is provided)

What it can do on your machine

Read from SKILL.md and the folder at commit af1c6c8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git and gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires a Git working tree. CI monitoring requires GitHub access (gh CLI authenticated, GitHub MCP server, or equivalent).

    From compatibility in the SKILL.md frontmatter.

Context cost

Rebase loads about 2.3k tokens when it runs. Until then it costs about 114 tokens; SKILL.md has 1,123 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~114
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from opsmill/infrahub at commit af1c6c8, republished under its Apache-2.0 licence (© opsmill). 1,123 words, ~2,268 tokens.

Download SKILL.mdSave it as .claude/skills/rebase/SKILL.md (or your agent's skills folder).
name
rebase
description
Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward. TRIGGER when: the user wants to rebase a feature branch, update a branch against its base, or replay local work on top of the latest upstream. DO NOT TRIGGER when: merging a release branch into dev → merging-branches; only watching CI on an already-open PR → monitoring-pull-requests.
compatibility
Requires a Git working tree. CI monitoring requires GitHub access (gh CLI authenticated, GitHub MCP server, or equivalent).
argument-hint
Optional `push` to force-push and monitor CI after a successful rebase
metadata.version
0.1.0
metadata.author
OpsMill

Rebase Branch

Introduction

Rebase the current branch onto the latest base branch, resolving any merge conflicts by preserving the intent of local changes. Optionally force-push and monitor CI status on GitHub.

Arguments

<arguments> $ARGUMENTS </arguments>

Supported arguments:

  • push — After a successful rebase, force-push the branch upstream and monitor GitHub Actions CI until completion.

Main Tasks

1. Assess Current State

Understand the branch topology and working tree before doing anything destructive.

  1. Run git status to check for uncommitted changes.
  2. Run git branch --show-current to identify the current branch.
  3. Determine the base branch (the long-lived branch this feature branch should land on):
    • Prefer the repository's default branch. Detect it with:

      bash
      git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null

      This typically returns origin/main, origin/master, origin/develop, or origin/stable. Use the branch name after origin/.

    • If origin/HEAD is not set, fall back to whichever of main, master, develop, or stable exists on the remote.

    • If the current branch was clearly forked from a different long-lived branch — including a release branch (e.g. release/*, release-*, or a version-named branch like 1.2/v1.2) — use that instead.

    • When the base branch is still ambiguous, ask the user which branch to rebase onto.

  4. If the current branch IS a long-lived branch — STOP: Rebasing these branches is not allowed. Inform the user and exit. Long-lived branches include the detected default branch, main/master/develop/stable, and release branches (release/*, release-*, version-named branches).
  5. If there are uncommitted changes — STOP: Inform the user they must commit or stash changes before rebasing. Do not proceed.
  6. Show the user a summary:
    • Current branch name.
    • Base branch.
    • Number of local commits (git log origin/<base-branch>..HEAD --oneline).
2. Update Base Branch & Rebase
  1. Fetch the latest remote state:

    bash
    git fetch origin
  2. Start the rebase:

    bash
    git rebase origin/<base-branch>
  3. If the rebase completes cleanly, skip to Phase 4.

3. Resolve Merge Conflicts

When conflicts arise, understand what the local commits intended to do and preserve that intent while incorporating upstream changes. For each conflict, read both sides and make an informed resolution.

For each conflict that arises during the rebase:

  1. Identify conflicting files:

    bash
    git diff --name-only --diff-filter=U
  2. For each conflicting file:

    • Read the file to see the conflict markers.

    • Inspect the commit currently being replayed — that is REBASE_HEAD, not HEAD (git show REBASE_HEAD, or git log -1 REBASE_HEAD). Mid-rebase, HEAD points at the last successfully applied commit, not the one that is conflicting.

    • Understand what the upstream change did vs what the local change intended.

    • Resolve the conflict by preserving the intent of local changes while incorporating any non-conflicting upstream changes.

    • Stage the resolved file:

      bash
      git add <file>
  3. Continue the rebase:

    bash
    git rebase --continue
  4. Repeat until the rebase completes. If a conflict is ambiguous, present both sides to the user and ask how to resolve it.

  5. After all conflicts are resolved, show the user a summary of what was resolved.

  6. Escape hatch. If a conflict is unresolvable, or the user wants to bail out at any point, run git rebase --abort to restore the branch to its exact pre-rebase state — nothing is lost. Never leave the user stranded in a half-finished rebase.

4. Verify Rebase Result
  1. Run a quick sanity check:

    bash
    git log origin/<base-branch>..HEAD --oneline
  2. Confirm the commit history looks correct (same number of local commits, no duplicates).

  3. If the project defines fast validation commands (formatters, linters), run them to catch any issues introduced by conflict resolution. Discover them from the project's own context — for example AGENTS.md/CONTAINER-style docs, a Makefile/Taskfile/justfile, package.json scripts, pyproject.toml/tox.ini, or a pre-commit config. Run whatever the project actually defines, then fix any issues introduced by conflict resolution. If the project defines no such commands, skip this step.

Show full SKILL.md (547 more words)Show less
5. Force Push & Monitor CI (only when push argument is provided)

Skip this phase entirely if push was NOT passed as an argument. Instead, inform the user the rebase is complete and they can push when ready.

When push IS provided:

  1. Force-push the rebased branch:

    bash
    git push --force-with-lease origin <branch-name>

    Use --force-with-lease as a safety measure to avoid overwriting unexpected upstream changes.

    Note: the git fetch origin in Phase 2 already advanced the remote-tracking ref that a bare --force-with-lease compares against, so a concurrent push to this branch between the fetch and the push would not be caught. If that risk matters, pin the SHA captured before the fetch: git push --force-with-lease=<branch-name>:<sha> origin <branch-name>.

  2. Discover the run the push triggered (be patient — CI can take several minutes to start):

    bash
    gh run list --branch <branch-name> --limit 5

    If nothing has started after a few minutes, investigate whether the push triggered a workflow.

  3. Wait for the run to finish with a single blocking call instead of polling repeatedly:

    bash
    gh run watch <run-id> --exit-status

    --exit-status returns non-zero if the run fails, so you can branch on the result directly. Fall back to periodic gh run list only if gh run watch is unavailable.

  4. If any jobs fail:

    • Read failure logs:

      bash
      gh run view <run-id> --log-failed
    • Analyze the failure and propose a fix to the user.

    • After approval, commit the fix, push, and continue monitoring.

  5. Report final CI status to the user.

Notes

Branch Safety:

  • This skill will NEVER rebase a long-lived branch — the repository's default branch, main/master/develop/stable, or a release branch (release/*, release-*, version-named branches).
  • Uses --force-with-lease instead of --force to prevent overwriting unexpected remote changes.
  • Will not proceed with uncommitted changes in the working tree.
  • git rebase --abort always restores the exact pre-rebase state — use it whenever a rebase cannot be completed cleanly rather than leaving the branch half-rebased.

Conflict Resolution Strategy:

  • Local changes take priority — the goal is to land our work on top of the latest base.
  • When both sides modify the same logic in incompatible ways, ask the user.
  • After resolution, run the project's formatters/linters (if any) to catch issues introduced by the merge.

Common Mistakes

  • Rebasing onto the wrong base. Confirm the detected base branch with the user before starting — landing work on the wrong long-lived branch is painful to unwind.
  • Forgetting the abort path. When a conflict cannot be resolved cleanly, git rebase --abort is the way back. Don't leave the user stranded mid-rebase.
  • Resolving by blindly taking one side. Accepting one side wholesale (e.g. -X ours/-X theirs) discards intent. Read both sides and preserve what the local commit meant to do.
  • Inspecting HEAD during a conflict. The commit being replayed is REBASE_HEAD, not HEAD. Looking at HEAD shows the wrong commit.
  • Force-pushing without --lease. Plain git push --force can silently clobber a teammate's push. Always use --force-with-lease.
  • Counting commits against a stale local base. Use origin/<base-branch>..HEAD, not the local ref, or the count can be wrong on an out-of-date or freshly cloned checkout.

Expected Outcome

A branch that:

  • Is cleanly rebased onto the latest base branch.
  • Has all merge conflicts resolved preserving local intent.
  • Passes the project's formatters and linters (if defined) after resolution.
  • (When push is provided) Is force-pushed upstream with passing CI.

© opsmill, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/rebase of opsmill/infrahub.

Open the folder on GitHubat commit af1c6c8

Compare with similar skills

Rebase next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rebase compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rebase this skillopsmill/infrahub529—~2.3kAutomated safety check: PassApache-2.0
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Git Branch Namingmakeplane/plane60k—~594Automated safety check: PassAGPL-3.0
Creating Description For Gh PRredis/jedis12k—~838Automated safety check: PassMIT

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Git Branch Naming

    makeplane/plane

    Names a new Git branch with a type prefix, the lowercased work item ID and a short kebab-case description, so the ID can be extracted later from the branch name.

    60k GitHub stars~594 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Official

    Generate a clear, concise GitHub PR title and description from the diff between two local git branches, and save it to prDescription.md in the repo root.

    12k GitHub stars~838 tokensUpdated today
    DevelopmentAuto-check passed
  • Opens a pull request for the current branch using the repo's template, a work item ID in the title and a description filled in from the actual diff.

    60k GitHub stars~824 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from opsmill/infrahub

All 32 skills in this repo
  • Analyzing CI Flakiness

    opsmill/infrahub

    Analyzes recent CI failures on pull requests to identify flaky tests, using retry outcomes (failed attempt → green re-run) and cross-PR recurrence as evidence, and maintains a local longitudinal…

    529 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Audit Docs

    opsmill/infrahub

    Audits internal (dev/) and external (docs/) documentation completeness for a feature, subject, or set of existing docs, maps changes indicated by the user, across Infrahub's documentation layers…

    529 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Commit

    opsmill/infrahub

    Stages and commits the current changes onto a safe working branch, enforcing branch discipline and optionally pushing upstream.

    529 GitHub stars~2.8k tokensUpdated today
    Auto-check: notes
  • A skill your agent uses when you've fixed a bug, added a feature, or made any user-facing change in a project that uses Towncrier and need to record it for the changelog — before committing or…

    529 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Creating Issues

    opsmill/infrahub

    Turns a single feature idea, improvement, or bug into ONE well-structured GitHub issue.

    529 GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Creating Prd

    opsmill/infrahub

    Synthesises the current conversation context into a Product Requirements Document and publishes it to GitHub (as a comment on a referenced issue, or a new issue).

    529 GitHub stars~4k tokensUpdated today
    Auto-check passed

Categories

Questions about Rebase

What does Rebase do?

Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward. Rebase is an agent skill from opsmill/infrahub. Rebases a feature branch onto its latest base, resolving conflicts while preserving the intent of local changes, optionally force-pushing and watching CI afterward.

When should I use Rebase?

Rebase fits situations like: : the user wants to rebase a feature branch; update a branch against its base; replay local work on top of the latest upstream; : merging a release branch into dev → merging-branches.

How do I install Rebase in Claude Code?

Run `npx skills add opsmill/infrahub --skill rebase -a claude-code`. Or copy the skill folder (.agents/skills/rebase in opsmill/infrahub) into .claude/skills/rebase in your project. Claude Code loads it when a task matches its description.

How do I install Rebase in Codex?

Run `npx skills add opsmill/infrahub --skill rebase -a codex`. Or copy the skill folder (.agents/skills/rebase in opsmill/infrahub) into .agents/skills/rebase in your project. Codex loads it when a task matches its description.

Can I use Rebase in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add opsmill/infrahub --skill rebase -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rebase, .gemini/skills/rebase, .github/skills/rebase and .opencode/skills/rebase in your project.

What does Rebase need to run?

Going by SKILL.md and its folder, Rebase needs the command-line tools its instructions call (git and gh). Compatibility (from SKILL.md): Requires a Git working tree. CI monitoring requires GitHub access (gh CLI authenticated, GitHub MCP server, or equivalent)..

Does Rebase access the network?

SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Rebase safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rebase use?

Rebase is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rebase use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rebase?

Skills that share tags, products or a category with Rebase: Finishing a Development Branch (obra/superpowers, 296k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars), Create Pull Request (cline/cline, 70k stars) and Git Branch Naming (makeplane/plane, 60k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rebase?

opsmill (a GitHub organization) maintains it in opsmill/infrahub, which has 529 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 7, 2026.

Source: opsmill/infrahub on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.