rebase

SKILL.md

Rebase onto Main

Rebase the current branch onto the latest main branch, resolving conflicts by preferring upstream changes.

Setup

Determine the repository for all gh commands:

REPO=$(./scripts/agents/tooling/agentTool.ts getRepo)

Always pass -R "$REPO" to gh commands.

Workflow

  1. Fetch latest changes:

    git fetch origin main >/dev/null
    
  2. Start rebase with upstream preference:

    git rebase -X theirs origin/main >/dev/null
    

    The -X theirs strategy resolves conflicts by preferring the upstream (main) version.

  3. If rebase fails (conflicts that can't be auto-resolved):

    • Check git status to see conflicting files

    • For each conflict, accept the upstream version:

      git checkout --theirs <file>
      git add <file>
      
    • Continue the rebase:

      git rebase --continue
      
    • Repeat until rebase completes

  4. Force push the rebased branch:

    git push --force-with-lease >/dev/null
    

Notes

  • This skill prefers upstream (main) changes when conflicts occur
  • Use this when you want to update your branch and don't mind losing local changes that conflict
  • The --force-with-lease flag is safer than --force as it won't overwrite remote changes you haven't seen
  • Always suppress stdout on git push to save tokens
Weekly Installs
2
Repository
a2f0/tearleads
First Seen
Feb 26, 2026
Installed on
amp2
cline2
opencode2
cursor2
kimi-cli2
codex2