AgentStack
SKILL verified MIT Self-run

Rebase Main

skill-flurdy-agent-skills-rebase-main · by flurdy

Rebase the current branch onto an updated main branch. Use when main has been updated and you need to incorporate those changes into your feature branch.

No reviews yet
0 installs
16 views
0.0% view→install

Install

$ agentstack add skill-flurdy-agent-skills-rebase-main

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Rebase Main? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Rebase onto Main

Rebase the current feature branch onto the latest main branch.

Usage

/rebase-main

Instructions

1. Check Current State

# Get current branch
git branch --show-current

# Check for uncommitted changes
git status --porcelain

If there are uncommitted changes, ask the user whether to:

  • Stash them before rebasing
  • Commit them first
  • Abort the rebase

2. Fetch Latest Main

git fetch origin main

3. Check if Rebase is Needed

# See how many commits main is ahead
git rev-list --count HEAD..origin/main

If main is not ahead, inform the user the branch is already up to date.

4. Perform Rebase

git rebase origin/main

5. Handle Conflicts

If conflicts occur:

  1. List the conflicting files:

``bash git diff --name-only --diff-filter=U ``

  1. For each conflicting file:
  • Read the file to understand the conflict
  • Resolve the conflict appropriately
  • Stage the resolved file: git add {file}
  1. Continue the rebase:

``bash git rebase --continue ``

  1. If conflicts are too complex, offer to abort:

``bash git rebase --abort ``

6. Verify With Tests

After the rebase completes (especially if conflicts were resolved), run the project's tests to confirm nothing was broken by the rebase or the conflict resolution.

Try the project's standard test command in this order:

# Prefer Makefile target if present
make test

# Otherwise the project's package manager
npm test
# or
npx 
# or
sbt test

If tests fail, stop and report to the user before pushing. Do not force-push a broken rebase. If the rebase was trivial (no conflicts) and the user wants to skip testing, they can say so — but default to running them.

7. Force Push (if branch was already pushed)

# Check if branch has upstream
git rev-parse --abbrev-ref @{upstream} 2>/dev/null

# If it does, force push with lease for safety
git push --force-with-lease

8. Report Result

Tell the user:

  • How many commits were rebased
  • Whether force push was needed
  • Any conflicts that were resolved

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.