AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Rebase Worktree Conflicts

skill-winens-agent-skills-rebase-worktree-conflicts · by winens

Rebase a worktree branch onto latest main and resolve merge conflicts. Use this skill whenever the user mentions rebasing, conflicts between branches, syncing a worktree with main, or says things like "rebase onto main", "my branch is behind", "merge conflicts", "sync with main", or "update my branch". Also trigger when the user pushes new commits to main and Claude's branch needs to catch up.

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

Install

$ agentstack add skill-winens-agent-skills-rebase-worktree-conflicts

✓ 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.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-winens-agent-skills-rebase-worktree-conflicts)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Rebase Worktree Conflicts? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Rebase Worktree Branch onto Main

When working in a worktree on a feature branch, the main branch may have advanced with commits that conflict with the feature work. This skill guides the rebase process to bring the feature branch up to date while resolving conflicts cleanly.

When This Applies

  • You're working in a worktree on a feature branch
  • Main has new commits that the feature branch doesn't have
  • Those new commits may touch the same files you've changed
  • The user asks you to sync, rebase, or update the branch

Step-by-Step Process

Step 1: Assess the Situation

Before touching anything, understand the current state:

# What branch are we on?
git branch --show-current

# How far behind main are we?
git fetch origin
git log --oneline HEAD..origin/main

Count the commits and note which files they touch:

git diff --name-only HEAD..origin/main

Compare this against your own changed files to anticipate conflicts:

git diff --name-only origin/main..HEAD

The intersection of these two file lists is where conflicts will happen.

Step 2: Rebase onto Main

git rebase origin/main

This replays each of your commits on top of the latest main, one at a time.

Step 3: Handle Conflicts

If rebase stops due to conflicts, git will tell you which files are conflicted. For each conflicted file:

  1. Read the file — look for conflict markers (>>>>>>)
  2. Understand both sides — the HEAD side is the incoming main commit, the other side is your feature work
  3. Resolve intelligently — don't just pick one side blindly:
  • If main renamed a function you're using, update your code to use the new name
  • If main restructured a file you're editing, adapt your edits to the new structure
  • If main added imports or fields near your changes, keep both
  1. Stage the resolved file: git add
  2. Continue the rebase: git rebase --continue

Repeat for each conflicted commit until rebase completes.

Step 4: When Conflicts Are Too Messy

If conflicts are spread across many commits and resolving one-by-one is painful, you can squash your work into a single commit first and then rebase:

# Abort the current rebase if in progress
git rebase --abort

# Squash all your commits into one
git reset --soft $(git merge-base HEAD origin/main)
git commit -m "feat: "

# Now rebase — only one round of conflicts
git rebase origin/main

This trades granular commit history for a much simpler conflict resolution process. Ask the user before squashing — they may prefer to keep individual commits.

Step 5: Verify

After a successful rebase:

# Confirm clean state
git status

# Verify your changes are still intact
git log --oneline origin/main..HEAD

# Quick build/test if applicable

Important Rules

  • Never force-push without explicit user permission. After a rebase, the branch history has changed and requires git push --force-with-lease. Always ask before pushing.
  • Never use --no-verify to skip hooks. If a hook fails, investigate and fix the root cause.
  • Preserve user intent — when resolving conflicts, your feature work should take priority over formatting or style changes from main. But structural changes from main (renames, new parameters, moved files) must be respected.
  • Communicate — tell the user how many commits were replayed, how many had conflicts, and what you resolved. If a conflict is ambiguous, ask the user rather than guessing.
  • Abort if stuck — if a conflict is genuinely unclear, git rebase --abort is safe and returns to the pre-rebase state. Ask the user for guidance.

Quick Reference

| Situation | Command | |---|---| | Check how far behind | git log --oneline HEAD..origin/main | | Start rebase | git rebase origin/main | | Continue after resolving | git rebase --continue | | Skip a commit (dangerous) | git rebase --skip | | Give up and go back | git rebase --abort | | Squash before rebase | git reset --soft $(git merge-base HEAD origin/main) | | Push after rebase | git push --force-with-lease (ask first!) |

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.