agentleFS
ronaknnathanironaknnathani/relay/skills/rebase/SKILL.md

rebase

Skill3 starsChanged 5 months agoMITView on GitHub

Use when you need to rebase the current branch onto main, resolve merge conflicts, and force-push

  • Deletes or force-pushes
  • Commits and pushes

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 10 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    If $ARGUMENTS contains a branch name, use it as the base.

    line 15
  2. Distinctive:

    If output is non-empty, the working tree is dirty.

    line 24
  3. Distinctive:

    Do NOT auto-stash — too easy to lose work.

    line 31
  4. Distinctive:

    If the rebase stops with conflicts:

    line 47
  5. Very specific:

    Run git diff --name-only --diff-filter=U to list conflicted files

    line 49
  6. Distinctive:

    Read the file to understand the conflict markers

    line 51
  7. Distinctive:

    Prefer keeping our changes where they don't conflict with upstream intent

    line 53
  8. Distinctive:

    If unsure about a conflict, ask the user

    line 54
  9. Distinctive:

    If more conflicts appear, repeat steps 1-4

    line 57
  10. Distinctive:

    Check whether the branch has an upstream:

    line 69
  11. Distinctive:

    If the command succeeds: check ahead/behind state:

    line 79
  12. Very specific:

    If both ahead == 0 and behind == 0: nothing to push, skip.

    line 84
  13. Distinctive:

    If the branch already has an open PR, the force-push updates it automatically.

    line 97

“Common” is measured: kept by at least 6 in 10 of the 12 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 — Rebase, Fix Conflicts, Push

Rebase the current branch onto the base branch (default: main), resolve any merge conflicts, and force-push.

Steps

1. Determine Base Branch

  • If $ARGUMENTS contains a branch name, use it as the base.
  • Otherwise, default to main.

2. Pre-check Working Tree

git status --porcelain

If output is non-empty, the working tree is dirty. Abort and report to the user:

Working tree has uncommitted changes. Commit or stash before rebasing:
  <output of git status --porcelain>

Do NOT auto-stash — too easy to lose work.

3. Fetch Latest

git fetch origin <BASE_BRANCH>

4. Rebase

git rebase origin/<BASE_BRANCH>

5. Handle Conflicts

If the rebase stops with conflicts:

  1. Run git diff --name-only --diff-filter=U to list conflicted files
  2. For each conflicted file:
    • Read the file to understand the conflict markers
    • Resolve the conflict by understanding both sides (ours = current branch work, theirs = base branch changes)
    • Prefer keeping our changes where they don't conflict with upstream intent
    • If unsure about a conflict, ask the user
  3. Stage the resolved files: git add <resolved-files>
  4. Continue the rebase: git rebase --continue
  5. If more conflicts appear, repeat steps 1-4
  6. Max 10 conflict rounds — if still conflicting, abort and ask the user

6. Verify

After successful rebase:

git log --oneline -5

7. Push

Check whether the branch has an upstream:

git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null
  • If the command fails (no upstream): the branch has never been pushed. Use:
    git push -u origin "$(git rev-parse --abbrev-ref HEAD)"
  • If the command succeeds: check ahead/behind state:
    ahead=$(git rev-list --count @{upstream}..HEAD)
    behind=$(git rev-list --count HEAD..@{upstream})
    • If both ahead == 0 and behind == 0: nothing to push, skip.
    • Otherwise (ahead, behind, or diverged): git push --force-with-lease

--force-with-lease (not --force) fails safely if someone else pushed to the branch.

8. Report

Rebased onto origin/<BASE_BRANCH>.
  Conflicts resolved: <COUNT> files
  Push: <force-with-lease | initial -u | skipped (already in sync)>

If the branch already has an open PR, the force-push updates it automatically.

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.