Agent skill

Rebase Branch On Master

by Cybereason-Public in Cybereason-Public/owLSM

Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection.

GPL-2.0Auto-check passedDevelopment

Install Rebase Branch On Master

skills CLI
$ npx skills add Cybereason-Public/owLSM --skill rebase-branch-on-master -a claude-code

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

GitHub CLI
$ gh skill install Cybereason-Public/owLSM rebase-branch-on-master --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/Cybereason-Public/owLSM.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/rebase-branch-on-master .claude/skills/rebase-branch-on-master && 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-branch-on-master
GitHub stars
280
Token cost
~1.9k tokens
SKILL.md length
473 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
GPL-2.0

At a glance

Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection.

  • Works in 6 steps: Record Initial State and Determine… → Stash Changes (if any) — PRESERVING… → Fetch and Update Target Branch → …
  • Tasks that involve Git workflow
  • SKILL.md covers Input Parameter, Pre-flight Checks (MUST ALL…, Critical Rule: ALWAYS Restore… and Workflow, plus 3 more sections
  • Calls git

What it does

Rebase Branch On Master is an agent skill from Cybereason-Public/owLSM. Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git workflow. It works with Linux and Git. The repository describes itself as: Sigma Rules Engine inside the Linux Kernel using eBPF. Focusing on prevention capabilities. The licence is GPL-2.0.

When your agent uses it

  • Tasks that involve Git workflow

Example prompts

  • “/rebase-branch-on-master”

Workflow steps

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

  1. Record Initial State and Determine Target Branch
  2. Stash Changes (if any) — PRESERVING STAGED/UNSTAGED STRUCTURE
  3. Fetch and Update Target Branch
  4. Attempt Rebase
  5. Push Changes
  6. Restore Stashed Changes — WITH STAGED/UNSTAGED PRESERVATION

What it can do on your machine

Read from SKILL.md and the folder at commit 8e541af. 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

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

  • Network

    No URLs in SKILL.md. Its commands use git, 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.

Context cost

Rebase Branch On Master loads about 1.9k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 473 words of instructions outside code blocks.

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

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 Cybereason-Public/owLSM at commit 8e541af, republished under its GPL-2.0 licence (© Cybereason-Public). 473 words, ~1,891 tokens.

Download SKILL.mdSave it as .claude/skills/rebase-branch-on-master/SKILL.md (or your agent's skills folder).
name
rebase-branch-on-master
description
Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection.

Rebase Branch onto Target

You are a Git workflow assistant that safely rebases the current branch onto a target branch.

Input Parameter

ParameterRequiredDefaultDescription
target_branchNomainThe branch to rebase onto. User can specify any branch name.

Example invocations:

  • "rebase my branch" → rebases onto main
  • "rebase onto develop" → rebases onto develop
  • "rebase on feature/base" → rebases onto feature/base

Pre-flight Checks (MUST ALL PASS before proceeding)

Before doing anything, verify ALL of the following. If ANY check fails, STOP and report the issue (and restore stash if already created):

  1. Target branch exists — The specified target branch must exist locally or on remote
  2. Not on target branch — Cannot rebase a branch onto itself
  3. Not on a detached HEAD — Must be on a named branch
  4. Remote exists — origin remote must be configured
  5. Network accessible — Can reach the remote (test with git ls-remote)
  6. No ongoing rebase/merge/cherry-pick — Check .git/rebase-merge, .git/MERGE_HEAD, .git/CHERRY_PICK_HEAD

Critical Rule: ALWAYS Restore Stash on Any Error

If a stash was created, it MUST be restored before reporting any error.

This is non-negotiable. Use try-finally logic:

  1. If stash was created → remember this
  2. Do all operations
  3. On ANY failure after stash → restore stash FIRST, then report error
  4. On success → restore stash at the end

Workflow

Step 1: Record Initial State and Determine Target Branch
bash
# Save current branch name
CURRENT_BRANCH=$(git branch --show-current)

# Target branch: use user-specified or default to "main"
TARGET_BRANCH="${USER_SPECIFIED_TARGET:-main}"

# Verify target branch exists (locally or on remote)
if ! git show-ref --verify --quiet "refs/heads/$TARGET_BRANCH" && \
   ! git show-ref --verify --quiet "refs/remotes/origin/$TARGET_BRANCH"; then
    echo "ERROR: Target branch '$TARGET_BRANCH' does not exist locally or on remote"
    exit 1
fi

# Verify we're not already on the target branch
if [ "$CURRENT_BRANCH" = "$TARGET_BRANCH" ]; then
    echo "ERROR: Already on target branch '$TARGET_BRANCH'. Cannot rebase onto itself."
    exit 1
fi
Step 2: Stash Changes (if any) — PRESERVING STAGED/UNSTAGED STRUCTURE

Check for uncommitted changes and stash them:

bash
# Check for any changes
HAS_CHANGES=false
if ! git diff --cached --quiet || ! git diff --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
    HAS_CHANGES=true
fi

STASH_CREATED=false
STASH_MSG=""

if [ "$HAS_CHANGES" = true ]; then
    # Stash everything including untracked files, with a unique marker
    STASH_MSG="rebase-skill-auto-stash-$(date +%s)-$$"
    git stash push -u -m "$STASH_MSG"
    STASH_CREATED=true
    echo "Stash created: $STASH_MSG"
fi
Step 3: Fetch and Update Target Branch

From this point on, ANY error must restore the stash first!

bash
# Fetch latest from remote
git fetch origin

# If target branch exists locally, update it
if git show-ref --verify --quiet "refs/heads/$TARGET_BRANCH"; then
    git checkout "$TARGET_BRANCH"
    if ! git pull origin "$TARGET_BRANCH" --ff-only; then
        echo "ERROR: Cannot fast-forward $TARGET_BRANCH. Local branch has diverged."
        # RESTORE STASH BEFORE EXITING
        restore_stash_if_needed
        exit 1
    fi
fi
Step 4: Attempt Rebase
bash
# Return to the original branch
git checkout "$CURRENT_BRANCH"

# Attempt rebase onto target (use origin/target if local doesn't exist)
if git show-ref --verify --quiet "refs/heads/$TARGET_BRANCH"; then
    REBASE_TARGET="$TARGET_BRANCH"
else
    REBASE_TARGET="origin/$TARGET_BRANCH"
fi

if ! git rebase "$REBASE_TARGET"; then
    # Rebase failed - ABORT to preserve original state
    git rebase --abort
    echo "ERROR: Rebase failed due to conflicts. Aborted to preserve original state."
    # RESTORE STASH BEFORE EXITING
    restore_stash_if_needed
    exit 1
fi

echo "Rebase successful!"
Step 5: Push Changes

Only if rebase succeeded:

bash
# Use --force-with-lease for safety (fails if remote has new commits we don't know about)
if ! git push --force-with-lease origin "$CURRENT_BRANCH"; then
    echo "WARNING: Push failed. Someone else may have pushed to this branch."
    echo "Local rebase is intact. You can retry push manually or investigate."
    # Still restore stash - this is a warning, not a fatal error
fi
Step 6: Restore Stashed Changes — WITH STAGED/UNSTAGED PRESERVATION

This step MUST run regardless of success/failure (if stash was created):

bash
restore_stash_if_needed() {
    if [ "$STASH_CREATED" = true ] && [ -n "$STASH_MSG" ]; then
        # Find our stash by its unique message
        STASH_REF=$(git stash list | grep "$STASH_MSG" | head -1 | cut -d: -f1)
        if [ -n "$STASH_REF" ]; then
            # Use --index to PRESERVE the staged/unstaged structure
            if git stash pop --index "$STASH_REF"; then
                echo "Stash restored successfully (staged/unstaged structure preserved)"
            else
                # If --index fails (can happen with conflicts), try without it
                echo "WARNING: Could not restore with staged/unstaged structure."
                echo "Attempting plain restore..."
                git stash pop "$STASH_REF" || {
                    echo "ERROR: Stash restore failed. Your changes are still in stash: $STASH_REF"
                    echo "Run 'git stash list' to see it and 'git stash pop' to restore manually."
                }
            fi
        else
            echo "WARNING: Could not find stash with message: $STASH_MSG"
        fi
    fi
}

# Always call this at the end
restore_stash_if_needed
Show full SKILL.md (186 more words)Show less

Error Handling Summary

ScenarioAction
Target branch doesn't existSTOP immediately (before stash)
Already on target branchSTOP immediately (before stash)
Detached HEADSTOP immediately (before stash)
Ongoing rebase/mergeSTOP immediately (before stash)
Network unreachableRestore stash, then STOP
Target branch divergedRestore stash, then STOP
Rebase conflictsAbort rebase, restore stash, then STOP
Push rejectedRestore stash, report warning (keep local rebase)
Stash pop conflictsReport — changes remain in stash for manual recovery

Output Format

Report the following at each stage:

  • Current branch: {branch_name}
  • Target branch: {target_branch} (user-specified or default)
  • Stash created: {yes|no}
  • Fetch result: {success|failure}
  • Rebase result: {success|aborted due to conflicts}
  • Push result: {success|failed|skipped}
  • Stash restored: {yes (with index)|yes (without index)|failed|N/A}

Safety Guarantees

  1. No data loss — All changes are stashed before any git operations
  2. Staged/unstaged preserved — Uses git stash pop --index to maintain staging structure
  3. Guaranteed stash restore — Stash is ALWAYS restored on any error after creation
  4. Atomic rebase — If rebase fails, it's fully aborted (not left half-done)
  5. Safe push — Uses --force-with-lease which fails if remote has unexpected commits
  6. Reversible — Original branch state is preserved if anything fails

© Cybereason-Public, GPL-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 .cursor/skills/rebase-branch-on-master of Cybereason-Public/owLSM.

Open the folder on GitHubat commit 8e541af

Compare with similar skills

Rebase Branch On Master 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 Branch On Master compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rebase Branch On Master this skillCybereason-Public/owLSM280—~1.9kAutomated safety check: PassGPL-2.0
SetupProrise-cool/Claude-Code-Multi-Agent306—~3kAutomated safety check: NotesNone
Git ConfigProrise-cool/Claude-Code-Multi-Agent306—~4.4kAutomated safety check: NotesNone
Gui ToolsProrise-cool/Claude-Code-Multi-Agent306—~2.4kAutomated safety check: NotesNone
Line EndingsProrise-cool/Claude-Code-Multi-Agent306—~3.1kAutomated safety check: NotesNone
Tapd Iteration InitTencentBlueKing/bk-bcs840—~1.3kAutomated safety check: PassCustom licence

Similar skills

  • Setup

    Prorise-cool/Claude-Code-Multi-Agent

    Complete guide to installing Git and performing basic configuration across all platforms (Windows, macOS, Linux, WSL).

    306 GitHub stars~3k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes
  • Git Config

    Prorise-cool/Claude-Code-Multi-Agent

    Comprehensive Git configuration guide covering global settings, aliases, performance tuning, credential management, maintenance, .gitattributes, clone shortcuts, and troubleshooting.

    306 GitHub stars~4.4k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes
  • Gui Tools

    Prorise-cool/Claude-Code-Multi-Agent

    Provides guidance for installing, configuring, and choosing Git graphical interface clients (GitKraken, Sourcetree, GitHub Desktop) across platforms.

    306 GitHub stars~2.4k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes
  • Line Endings

    Prorise-cool/Claude-Code-Multi-Agent

    Comprehensive guide to Git line ending configuration for cross-platform development teams.

    306 GitHub stars~3.1k tokensUpdated 25 days ago
    DevelopmentAuto-check: notes
  • Tapd Iteration Init

    TencentBlueKing/bk-bcs

    迭代执行流水线启动器。分三个阶段执行:信息检查(验证 git 环境、获取迭代信息、 解析迭代分支)→ 恢复检测(已有状态文件时判定恢复策略)→ 新流程初始化(创建分支、 迭代目录和 iteration-state.json)。

    840 GitHub stars~1.3k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Dev Pitfalls

    TheDecipherist/claude-code-mastery-project-starter-kit

    Common pitfalls that are slow to troubleshoot and that tend to get "fixed" by going in circles, because the error message points nowhere near the actual cause.

    338 GitHub stars~3.3k tokensUpdated 3 mo ago
    DevelopmentAuto-check: notes

More from Cybereason-Public/owLSM

All 9 skills in this repo
  • K8s Security Policies

    Cybereason-Public/owLSM

    Comprehensive guide for implementing NetworkPolicy, PodSecurityPolicy, RBAC, and Pod Security Standards in Kubernetes.

    280 GitHub starsUsed in 12 repos~2k tokens
    Auto-check passed
  • Helm Chart Scaffolding

    Cybereason-Public/owLSM

    Comprehensive guidance for creating, organizing, and managing Helm charts for packaging and deploying Kubernetes applications.

    280 GitHub starsUsed in 13 repos~381 tokens
    Auto-check passed
  • Kubernetes Architect

    Cybereason-Public/owLSM

    Expert Kubernetes architect specializing in cloud-native infrastructure, advanced GitOps workflows (ArgoCD/Flux), and enterprise container orchestration.

    280 GitHub starsUsed in 9 repos~2.6k tokens
    Auto-check passed
  • K8s Manifest Generator

    Cybereason-Public/owLSM

    Step-by-step guidance for creating production-ready Kubernetes manifests including Deployments, Services, ConfigMaps, Secrets, and PersistentVolumeClaims.

    280 GitHub starsUsed in 12 repos~433 tokens
    Auto-check passed
  • Add Gitmcp

    Cybereason-Public/owLSM

    Adds a GitMCP URL for a GitHub repository to the project's MCP configuration (.cursor/mcp.json).

    280 GitHub stars~919 tokensUpdated 3 days ago
    Auto-check passed
  • GitHub Issues

    Cybereason-Public/owLSM

    Manage GitHub issues - create, edit, close, comment, assign, and delegate to Copilot.

    280 GitHub stars~1.8k tokensUpdated 3 days ago
    Auto-check passed

Works with

Categories

Questions about Rebase Branch On Master

What does Rebase Branch On Master do?

Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection. Rebase Branch On Master is an agent skill from Cybereason-Public/owLSM. Safely rebases the current feature branch onto a target branch (default: main) with automatic stash handling and conflict detection.

When should I use Rebase Branch On Master?

Rebase Branch On Master fits situations like: tasks that involve Git workflow.

How do I install Rebase Branch On Master in Claude Code?

Run `npx skills add Cybereason-Public/owLSM --skill rebase-branch-on-master -a claude-code`. Or copy the skill folder (.cursor/skills/rebase-branch-on-master in Cybereason-Public/owLSM) into .claude/skills/rebase-branch-on-master in your project. Claude Code loads it when a task matches its description.

How do I install Rebase Branch On Master in Codex?

Run `npx skills add Cybereason-Public/owLSM --skill rebase-branch-on-master -a codex`. Or copy the skill folder (.cursor/skills/rebase-branch-on-master in Cybereason-Public/owLSM) into .agents/skills/rebase-branch-on-master in your project. Codex loads it when a task matches its description.

Can I use Rebase Branch On Master 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 Cybereason-Public/owLSM --skill rebase-branch-on-master -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-branch-on-master, .gemini/skills/rebase-branch-on-master, .github/skills/rebase-branch-on-master and .opencode/skills/rebase-branch-on-master in your project.

What does Rebase Branch On Master need to run?

Going by SKILL.md and its folder, Rebase Branch On Master needs the command-line tools its instructions call (git).

Does Rebase Branch On Master access the network?

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

Is Rebase Branch On Master 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 Branch On Master use?

Rebase Branch On Master is published under the GPL-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 Branch On Master use?

About 1.9k tokens (SKILL.md is roughly 7.6k 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 Branch On Master?

Skills that share tags, products or a category with Rebase Branch On Master: Setup (Prorise-cool/Claude-Code-Multi-Agent, 306 stars), Git Config (Prorise-cool/Claude-Code-Multi-Agent, 306 stars), Gui Tools (Prorise-cool/Claude-Code-Multi-Agent, 306 stars) and Line Endings (Prorise-cool/Claude-Code-Multi-Agent, 306 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rebase Branch On Master?

Cybereason-Public (a GitHub organization) maintains it in Cybereason-Public/owLSM, which has 280 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 8, 2026.

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