agentleFS
MarcusJellinghausMarcusJellinghaus/mcp-workspace/.claude/skills/rebase/SKILL.md

rebase

Skill49 starsChanged 2 days agoMITView on GitHub

Rebase feature branch onto base branch with conflict resolution

  • Deletes or force-pushes
  • Commits and pushes

28 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-watch, perform-task and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • telegramdesktopSkill

    dependency-watch

    Audit Telegram Desktop dependencies on freshly fetched origin/dev for releases and security fixes, including upstream lag and backport candidates in patched forks. Use for the scheduled dependency monitor or an explicitly requested dependency report.

    Also in 5 projects that use this

  • telegramdesktopSkill

    perform-task

    Resolve, start or resume, implement, review, test, and publish exactly one existing ai-tdesktop task by short slug or full dated id, including rare blocked retries and split-required results. Use when the user invokes $perform-task or /perform-task with a known task name, or when the continue scheduler delegates one selected task. Runs standard review lenses with fast applicability bailouts and selects task-specific domain and evidence instruments without selecting additional work.

    Also in 5 projects that use this

  • JerovinoSkill

    process-inbox

    Processes tasks.md inbox items by triaging each one to its proper location in the vault

    Also in 5 projects that use this

  • Trejon-888Skill

    continue

    Load project context, alignment audit, status check, suggest next action. Auto-invoke at session start, after context switches, or when user says 'continue', 'pick up where we left off', 'resume', 'what's next', 'status check', 'what now'.

    Also in 6 projects that use this

  • lepinkainenSkill

    code-health

    Analyze codebase health - large files, test coverage gaps, duplicate code, dead/legacy code, and documentation issues. Use when asked to scan, audit, or assess code quality, find refactoring targets, or identify technical debt.

    Also in 3 projects that use this

  • dekozaSkill

    fix-pr

    Repair an existing pull request's review findings and target-branch conflicts, verify the result, and update the same open PR.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 5 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 28 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call mcp__mcp-workspace__git with command "status" before doing anything else.

    line 39
  2. Distinctive:

    If the rebase becomes complex, suggest switching to cherry-picking as an alternative approach.

    line 47
  3. Very specific:

    Call mcp__mcp-workspace__get_base_branch to detect the correct base branch.

    line 51
  4. Distinctive:

    If the base branch is not main or master, ask the user to confirm before proceeding.

    line 55
  5. Distinctive:

    Not already in rebase/merge state

    line 60
  6. Distinctive:

    Not on main/master branch

    line 61
  7. Very specific:

    Call mcp__mcp-workspace__git with command "fetch" and args ["origin"]

    line 67
  8. Very specific:

    Run the Branch Moved Check (below), which also captures PRE_SHA.

    line 68
  9. Very specific:

    If file is under pr_info/: auto-resolve with git checkout --theirs <file> (keep feature branch version), then git add <file> — no user …

    line 71
  10. Distinctive:

    Verify no conflict markers remain

    line 73
  11. Very specific:

    Run code checks: mcp__mcp-tools-py__run_pytest_check, mcp__mcp-tools-py__run_pylint_check, mcp__mcp-tools-py__run_mypy_check

    line 76
  12. Very specific:

    All calls go through mcp__mcp-workspace__git:

    line 91
  13. Very specific:

    Use refs/remotes/origin/<branch>, not the bare name: a tag named origin/<branch> makes the check pass wrongly.

    line 103

“Common” is measured: kept by at least 6 in 10 of the 28 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rebase Branch onto Base Branch

First Step

Call mcp__mcp-workspace__git with command "status" before doing anything else.

Rebase the current feature branch onto its base branch and resolve conflicts.

Core philosophy: Main is the source of truth. The feature branch adapts to main. For source code conflicts, preserve main's improvements and rework the feature branch code to fit.

Note on --ours/--theirs during rebase: --ours = main (the branch being rebased onto), --theirs = feature branch commits being replayed.

If the rebase becomes complex, suggest switching to cherry-picking as an alternative approach.

Determine Base Branch

Call mcp__mcp-workspace__get_base_branch to detect the correct base branch. Use the returned branch name in subsequent git commands.

Base Branch Confirmation

If the base branch is not main or master, ask the user to confirm before proceeding. Display the detected base branch and wait for explicit approval.

Pre-flight Checks (Abort if any fail)

  1. Working directory is clean (no uncommitted changes)
  2. Not already in rebase/merge state
  3. Not on main/master branch
  4. Remote origin exists
  5. pr_info/ does not exist on the base branch — if it does, abort with error: "pr_info/ exists on <BASE_BRANCH>. This folder should only exist on feature branches. Check your branch setup."

Workflow

  1. Call mcp__mcp-workspace__git with command "fetch" and args ["origin"]
  2. Run the Branch Moved Check (below), which also captures PRE_SHA. If it stops: report it. Nothing to undo.
  3. git rebase origin/${BASE_BRANCH}
  4. For each conflict:
    • If file is under pr_info/: auto-resolve with git checkout --theirs <file> (keep feature branch version), then git add <file> — no user input needed
    • For all other files: resolve manually, preserving main's improvements; rework feature branch changes to fit
    • Verify no conflict markers remain
    • git add <file>
    • git rebase --continue
  5. Run code checks: mcp__mcp-tools-py__run_pytest_check, mcp__mcp-tools-py__run_pylint_check, mcp__mcp-tools-py__run_mypy_check
  6. Fix any issues from merge
  7. Report summary
  8. Repeat the Branch Moved Check against the same PRE_SHA. If it stops: do not push, and print git reset --hard <PRE_SHA> for the human to run.
  9. Push, choosing by the Branch Moved Check result:
    • refs/remotes/origin/<branch> absent (never pushed): mcp__mcp-workspace__git_push.
    • Otherwise: mcp__mcp-workspace__git_push_force. If it refuses with a message containing needs git 2.30+ or has no reflog, run git push --force-with-lease instead.
    • Any other refusal or failure: report it and stop. This is not Abort Rule 1 — do not run git rebase --abort; the rebase has already completed.

Branch Moved Check

Why: a fetch refreshes the tracking ref, which disables the lease for commits someone else pushed. git push --force-with-lease would then remove those commits from the remote and still succeed. The check stops the run if origin/<branch> has commits this checkout did not have before the rebase.

All calls go through mcp__mcp-workspace__git:

  1. branch = command "branch", args ["--show-current"]
  2. PRE_SHA = command "rev_parse", args ["HEAD"]. Capture this once, before the rebase; the repeat in workflow step 8 reuses it. Do not read HEAD again.
  3. Command "rev_parse", args ["--verify", "refs/remotes/origin/<branch>"]
    • Error fatal: Needed a single revision: the ref is absent. Skip the rest of this check; workflow step 9 uses git_push.
    • Any other error: stop as described in the workflow step, and report it.
  4. Command "merge_base", args ["--is-ancestor", "refs/remotes/origin/<branch>", PRE_SHA]
    • "true": continue.
    • "false": someone else pushed to the branch. Stop as described in the workflow step, and report it.
    • Error: not a pass. Stop as described in the workflow step, and report it.

Use refs/remotes/origin/<branch>, not the bare name: a tag named origin/<branch> makes the check pass wrongly.

Abort instruction: an error from this check is a stop, not Abort Rule 1, and the git rebase --abort line under Abort Rules does not apply to either stop. At the first, no rebase has started. At the second, the rebase has already completed.

Do not work around it: on a stop, do not fetch and push again. The next fetch only hides the foreign commit from the lease.

Conflict Resolution Strategies

File TypeStrategy
pr_info/ filesAuto-resolve with --theirs (keep feature branch version)
Code files (.py, .js, etc.)Keep both sides, merge imports
Test filesKeep all tests from both sides
Config filesMerge additively, prefer HEAD for same keys
Lockfiles (*-lock.json, *.lock)Accept theirs (--theirs), notify user to regenerate after rebase

Abort Rules (in priority order)

  1. Any unexpected error - abort, report full error
  2. Binary file conflict - abort, cannot auto-resolve
  3. Conflict markers remain after resolution - abort
  4. Same file conflicts 3+ times - abort
  5. Code quality fails after 2 fix attempts - abort
  6. Any other unexpected situation - abort, suggest manual intervention

On abort: run git rebase --abort, report which rule triggered, suggest next steps.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.