Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
Christopher Boone avatar

Rebase Onto Main

  • 2 repo stars
  • Updated July 24, 2026
  • cboone/agent-harness-plugins

Fetch and rebase the current feature branch onto the base branch with automatic conflict resolution and force-with-lease push.

About

Rebase-onto-main fetches and rebases the current feature branch onto the base branch, resolving conflicts automatically and pushing with force-with-lease. It keeps in-progress branches up to date with main safely and with minimal friction. Aimed at developers maintaining clean, current feature branches.

  • Fetch + rebase onto base
  • Automatic conflict resolution
  • force-with-lease push
  • Branch hygiene

Rebase Onto Main by the numbers

  • Data as of Jul 25, 2026 (Skillselion catalog sync)
/plugin marketplace add cboone/agent-harness-plugins
/plugin install rebase-onto-main@agent-harness-plugins

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars2
Last updatedJuly 24, 2026
Repositorycboone/agent-harness-plugins

What it does

Fetch and rebase the current feature branch onto the base branch with automatic conflict resolution and force-with-lease push.

README.md

Rebase Onto Main

Fetch and rebase the current feature branch onto the repository's base branch.

Type: Skill Trigger: /rebase-onto-main Requires: gh (falls back to git remote show origin if unavailable)

Installation

See the marketplace install instructions.

What It Does

Automatically detects the default branch, handles uncommitted changes (stash, commit, or abort), resolves conflicts per replayed commit, and pushes after a successful rebase (using --force-with-lease only when the rebase rewrote history). Suggests running install commands when lockfiles change.

Unlike a merge, a rebase rewrites history: each commit on the feature branch is replayed on top of the base branch. Conflicts are resolved per commit, and any branch that has already been pushed requires a --force-with-lease push afterward. The skill never uses plain --force.

Usage

/rebase-onto-main
/rebase-onto-main --base develop
Option Description
--base <branch> Override the auto-detected base branch

Recommended Permissions

This skill runs git and GitHub CLI commands that trigger permission prompts. To allow them automatically, add these rules to your .claude/settings.json (project-wide) or ~/.claude/settings.json (global):

{
  "permissions": {
    "allow": ["Bash(git status*)", "Bash(git branch *)", "Bash(git fetch *)", "Bash(git rebase *)", "Bash(git commit *)", "Bash(git push*)", "Bash(git stash*)", "Bash(git log *)", "Bash(git diff*)", "Bash(git add *)", "Bash(git remote *)", "Bash(git rev-parse *)", "Bash(git merge-base *)", "Bash(gh repo view *)"]
  }
}

If you already have a permissions.allow array, merge these entries into it. Review and adjust the rules to match your security preferences.

Examples

  • "rebase onto main": fetches the default branch and rebases the current branch on top
  • "rebase onto main --base develop": rebases onto develop instead
  • "update branch via rebase": same as "rebase onto main"

Force-Push Safety

After a rebase, the local branch's history may diverge from any previously pushed copy. The skill picks the push command based on whether the rebase actually rewrote history:

  • History rewritten (commits replayed onto a new base): git push --force-with-lease, which refuses to overwrite the remote if someone else has pushed in the meantime.
  • No-op or fast-forward only (HEAD unchanged after rebase): a plain git push, since nothing was rewritten.
  • No upstream yet (fresh branch never pushed): git push -u origin HEAD, no force needed.

The skill never uses plain --force, and never force-pushes the default branch.

See Also

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.