agentleFS
NVIDIAKnown publisherNVIDIA/k8s-test-infra/.claude/skills/rebase/SKILL.md

rebase

Skill115 starsChanged 5 days agoApache-2.0View on GitHub

Rebase the current branch onto the latest main and resolve conflicts

  • Deletes or force-pushes
  • Commits and pushes

28 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-watch, perform-task and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • telegramdesktopSkill

    dependency-watch

    Audit Telegram Desktop dependencies on freshly fetched origin/dev for releases and security fixes, including upstream lag and backport candidates in patched forks. Use for the scheduled dependency monitor or an explicitly requested dependency report.

    Also in 5 projects that use this

  • telegramdesktopSkill

    perform-task

    Resolve, start or resume, implement, review, test, and publish exactly one existing ai-tdesktop task by short slug or full dated id, including rare blocked retries and split-required results. Use when the user invokes $perform-task or /perform-task with a known task name, or when the continue scheduler delegates one selected task. Runs standard review lenses with fast applicability bailouts and selects task-specific domain and evidence instruments without selecting additional work.

    Also in 5 projects that use this

  • JerovinoSkill

    process-inbox

    Processes tasks.md inbox items by triaging each one to its proper location in the vault

    Also in 5 projects that use this

  • Trejon-888Skill

    continue

    Load project context, alignment audit, status check, suggest next action. Auto-invoke at session start, after context switches, or when user says 'continue', 'pick up where we left off', 'resume', 'what's next', 'status check', 'what now'.

    Also in 6 projects that use this

  • lepinkainenSkill

    code-health

    Analyze codebase health - large files, test coverage gaps, duplicate code, dead/legacy code, and documentation issues. Use when asked to scan, audit, or assess code quality, find refactoring targets, or identify technical debt.

    Also in 3 projects that use this

  • dekozaSkill

    fix-pr

    Repair an existing pull request's review findings and target-branch conflicts, verify the result, and update the same open PR.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 28 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never git rebase --abort or drop the user's commits without asking.

    line 14
  2. Distinctive:

    Stop and report if: not a git repo, detached HEAD, or the current branch *is* the base branch.

    line 19
  3. Very specific:

    If git merge-base --is-ancestor <remote>/<branch> HEAD succeeds, it's already up to date: skip to step 5.

    line 30
  4. Distinctive:

    Delete/modify conflicts: decide from the intent, then git rm or git add.

    line 48
  5. Distinctive:

    If the intent is ambiguous or the two sides are incompatible, stop and ask the user, leaving the rebase in progress.

    line 49
  6. Very specific:

    Make sure no markers are left: git diff --check and grep -nE '^(<<<<<<<|>>>>>>>)( |$)' <files>.

    line 50
  7. Distinctive:

    If git says the commit is now empty (upstream already has the change), run git rebase --skip and mention it in the report.

    line 52
  8. Distinctive:

    If signing fails, git reset --soft ORIG_HEAD restores the rebased commits.

    line 63
  9. Very specific:

    Every rebased commit is signed and signed off.

    line 68
  10. Very specific:

    If you resolved conflicts, run the project's quick build/lint/tests for the touched code (from the Makefile, package scripts, or CLAUDE.md).

    line 73
  11. Very specific:

    If the branch has an upstream: git push --force-with-lease origin HEAD:<current-branch>

    line 80
  12. Very specific:

    If it has none yet: git push --force-with-lease -u origin HEAD:<current-branch>

    line 81
  13. Very specific:

    If the lease is rejected (someone else pushed to the branch), stop.

    line 83

“Common” is measured: kept by at least 6 in 10 of the 28 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 onto latest main

Arguments from the user (may be empty): $ARGUMENTS

  • A branch name overrides the base branch.
  • --no-push (or any wording like "don't push", "no push", "local only") disables the push in step 7.

Never git rebase --abort or drop the user's commits without asking.

1. Preflight

  • git status — if a rebase is already in progress, do the single-commit check from step 2, then skip to step 4 (resolve conflicts).
  • Stop and report if: not a git repo, detached HEAD, or the current branch is the base branch.
  • Working tree dirty? Ask the user: stash (git stash push -u, then git stash pop at the end) or stop.

2. Pick and fetch the base

  • Remote: upstream if it exists (fork workflow), else origin.
  • Branch: the branch named in the arguments if given, else the remote's default branch with the remote prefix stripped (ref=$(git symbolic-ref --short refs/remotes/<remote>/HEAD) && echo "${ref#<remote>/}", since --short returns <remote>/main), falling back to main, then master.
  • git fetch <remote> <branch> — always rebase onto <remote>/<branch>, never a stale local main.
  • Note the old HEAD SHA (git rev-parse HEAD) for the report, and show git log --oneline <remote>/<branch>..HEAD.
  • Single-commit PR? Before rebasing, count the PR's commits: git rev-list --count <remote>/<branch>..origin/<current-branch> (the branch as last pushed, i.e. what the PR shows; don't fetch it, since that would defeat the lease in step 7). If it was never pushed, count <remote>/<branch>..<current-branch> instead. If the count is 1, step 5 squashes the branch back into one commit.
  • If git merge-base --is-ancestor <remote>/<branch> HEAD succeeds, it's already up to date: skip to step 5.

3. Rebase

git rebase --signoff -S <remote>/<branch>

(--signoff, not -s: for rebase -s means --strategy.) If signing fails, stop and report the error. Don't retry unsigned.

4. Resolve conflicts (repeat until the rebase finishes)

While a rebase is running, "ours" = the base (upstream + already-replayed commits) and "theirs" = the user's commit being replayed.

  1. git diff --name-only --diff-filter=U to list conflicted files; git show REBASE_HEAD to see what the user's commit intended.
  2. Find out why upstream changed the same code: git log --oneline -p ORIG_HEAD..<remote>/<branch> -- <file>.
  3. Edit each file so that both intents survive (e.g., upstream added a parameter and the commit changed the format → keep the parameter and the new format). Don't just pick a side.
  4. Lockfiles/generated files: take the base version, then regenerate them with the project's tool if the commit changed dependencies.
  5. Delete/modify conflicts: decide from the intent, then git rm or git add.
  6. If the intent is ambiguous or the two sides are incompatible, stop and ask the user, leaving the rebase in progress.
  7. Make sure no markers are left: git diff --check and grep -nE '^(<<<<<<<|>>>>>>>)( |$)' <files>.
  8. git add <files> then git rebase --continue (the Claude Code shell already sets GIT_EDITOR=true).
  9. If git says the commit is now empty (upstream already has the change), run git rebase --skip and mention it in the report.

5. Squash single-commit PRs back to one commit

Skip this unless step 2 counted a single-commit PR and git rev-list --count <remote>/<branch>..HEAD is now more than 1. Then fold everything into one commit that keeps the first commit's message and author (run it as one shell call so $first survives):

first=$(git rev-list --reverse <remote>/<branch>..HEAD | head -n1)
git reset --soft <remote>/<branch> && git commit -s -S -C "$first"

If signing fails, git reset --soft ORIG_HEAD restores the rebased commits; then stop and report the error.

6. Verify

  • git status is clean with no rebase in progress; git log --oneline <remote>/<branch>..HEAD shows the user's commits.
  • Every rebased commit is signed and signed off. Check signatures through the raw header, since %G? reports N for SSH signatures without an allowedSignersFile:
    for c in $(git rev-list <remote>/<branch>..HEAD); do git cat-file -p "$c" | grep -q '^gpgsig' || echo "UNSIGNED $c"; done
    git log --format='%h %(trailers:key=Signed-off-by,valueonly,separator=%x2C )' <remote>/<branch>..HEAD
  • If you resolved conflicts, run the project's quick build/lint/tests for the touched code (from the Makefile, package scripts, or CLAUDE.md). Ask before starting anything slow.

7. Push (default) and report

Push by default unless the arguments disabled it. Only push when the rebase finished and every step 6 check passed. If anything failed or is still unresolved, don't push and say why.

  • Push to the fork origin, never upstream. Always name the remote and destination: a bare git push follows the branch's configured upstream, which can be upstream/<branch> (e.g. a stack branch from /release).
    • If the branch has an upstream: git push --force-with-lease origin HEAD:<current-branch>
    • If it has none yet: git push --force-with-lease -u origin HEAD:<current-branch>
  • Skip the push when nothing changed (step 2 found it already up to date and the remote branch matches HEAD).
  • If the lease is rejected (someone else pushed to the branch), stop. Don't fall back to --force. Run git fetch origin <current-branch>, show git log --oneline HEAD..origin/<current-branch>, and ask the user.

Report briefly: base used, commits replayed, each conflict and how you resolved it, skipped commits, the squash (subjects of the folded-in commits), verification results, push result, and the old HEAD SHA (undo: git reset --hard <sha>).

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.