Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear.

GPL-3.0Auto-check passedDevelopment

Install Rebase

skills CLI
$ npx skills add telegramdesktop/tdesktop --skill rebase -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install telegramdesktop/tdesktop rebase --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/telegramdesktop/tdesktop.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rebase .claude/skills/rebase && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rebase
GitHub stars
33k
Used in
1 other repo
Token cost
~3.7k tokens
SKILL.md length
1,983 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
GPL-3.0

At a glance

Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear.

  • Works in 9 steps: Read the request → Preflight → Start → …
  • The user invokes $rebase
  • SKILL.md covers Hard rules, Host mechanics, 1. Read the request and 2. Preflight, plus 7 more sections
  • Calls git

What it does

Rebase is an agent skill from telegramdesktop/tdesktop. Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear. Use when the user invokes $rebase or /rebase, asks to rebase a branch onto another ref, to move the tail of a branch onto a new base, or to continue or abort a rebase that is already in progress.

Its SKILL.md is about 3.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git workflow. It works with Git and Telegram. The repository describes itself as: Telegram Desktop messaging app. The licence is GPL-3.0.

When your agent uses it

  • The user invokes $rebase
  • Asks to rebase a branch onto another ref
  • Move the tail of a branch onto a new base
  • Abort a rebase that is already in progress

Example prompts

  • “/rebase”

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Read the request
  2. Preflight
  3. Start
  4. How much to read
  5. For every conflict: read before you write
  6. Two traps
  7. Resume
  8. Verify the whole rebase
  9. Report

What it can do on your machine

Read from SKILL.md and the folder at commit f23c378. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rebase loads about 3.7k tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 1,983 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~3.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from telegramdesktop/tdesktop at commit f23c378, republished under its GPL-3.0 licence (© telegramdesktop). 1,983 words, ~3,721 tokens.

Download SKILL.mdSave it as .claude/skills/rebase/SKILL.md (or your agent's skills folder).
name
rebase
description
Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear. Use when the user invokes $rebase or /rebase, asks to rebase a branch onto another ref, to move the tail of a branch onto a new base, or to continue or abort a rebase that is already in progress.

Intent-Aware Rebase

Run one rebase in the current checkout and resolve every conflict by understanding what each side was trying to do. A conflict is two authors disagreeing about code, not a syntax error: the resolution is the code they would have written together, expressed in the shape the upstream side has now.

The request is whatever the user typed with the invocation. When running in Claude Code, read .claude/commands/rebase.md for that host's substitutions; when running in Grok Build, read .grok/commands/rebase.md.

Hard rules

  • Operate only in the current worktree. Never write into a sibling checkout slot, and never rebase a branch that git worktree list shows checked out elsewhere — say where it is instead.
  • Never push, never force-push, never delete the backup ref, never touch origin/private refs beyond an explicitly confirmed fetch.
  • Never run git rebase -i, git add -i, or anything else that opens an editor; these hosts have no interactive terminal. Use git -c core.editor=true for every rebase --continue. If commits must be dropped or reordered, do it with a non-interactive GIT_SEQUENCE_EDITOR and show the todo list you are producing.
  • Never resolve with git checkout --ours/--theirs <file>, never delete a hunk to make the build pass, never leave a conflict marker, never --skip a commit to escape a hard conflict.
  • This is a branch-integration operation. It is never an ai-tdesktop task: do not create, claim, or publish task records for it, and do not route it through perform-task, continue, or process-inbox.
  • Resolve conflicts in this session, with both sides in context. Delegation is for gathering, never for deciding: a leaf may summarize history you name, but it must not write a resolution.

Host mechanics

  • Asking the user. Where this document says to ask, use the host's structured question mechanism if it has one, and otherwise end the turn with a short numbered question and stop. Never continue a rebase past a question you have not had answered.
  • Checkout kind. In a native Windows checkout run git directly. In the WSL checkout reached through \\wsl.localhost\..., route every git command through wsl.exe -d {distro} --cd /home/{user}/Telegram/tdesktop -- git ... per AGENTS.md; native Windows git over that UNC path fails with detected dubious ownership.
  • Line endings. Keep each file's existing convention — CRLF in a native Windows checkout, LF in the WSL checkout — and never add a BOM. A git diff --stat that shows a whole-file rewrite means you broke them.

1. Read the request

Accept free prose. The shapes to recognize:

RequestCommand
onto <ref>git rebase <ref> for the current branch
<branch> onto <ref>git rebase <ref> <branch>
tail of <branch> on top of <ref>git rebase --onto <ref> <base> <branch> — <base> is the last commit that stays behind, exclusive
bare <ref>treat as onto <ref>
emptycurrent branch onto its upstream; if there is none, ask
continue / resumejump to §7
abortgit rebase --abort, report the restored tip, stop

When the user proposes a literal command ("I believe command should be git rebase --onto private/alpha abcdefg alpha"), take it as a strong hint, not as gospel: resolve its refs and print the commit list it would actually replay. If that list disagrees with the prose — wrong <base>, a commit that should stay behind, a <base> that is not an ancestor of <branch> — say so plainly with the evidence and propose the corrected command.

Remote-tracking targets (private/*, origin/*) are local snapshots. Do not fetch on your own: print the target's sha, subject and commit date so staleness is visible, and ask before fetching if it looks old or the user mentions freshness.

Record these once and reuse them everywhere below:

  • ONTO — the new base, resolved to a sha.
  • REPLAY_BASE — exclusive start of the replayed range (<base> for the --onto form, otherwise git merge-base <ONTO> <branch>).
  • OLD_TIP — the branch tip before the rebase.

Print the plan: the exact command, ONTO (sha, subject, date), the replay list git log --oneline REPLAY_BASE..OLD_TIP, and the likely conflict surface —

bash
comm -12 \
  <(git diff --name-only REPLAY_BASE OLD_TIP | sort) \
  <(git diff --name-only REPLAY_BASE ONTO | sort)

Proceed without asking when the reading is unambiguous. Ask when two readings would replay different commits, or when the user's proposed command and prose disagree.

2. Preflight

  • In-progress rebase — git rev-parse --git-path rebase-merge / rebase-apply exists: do not start a new one. Go to §7.
  • Dirty tree — git status --porcelain non-empty: stop and ask (commit, stash, or cancel). Never stash silently.
  • Backup, always, before the first replay:
bash
git branch backup/<branch>-$(date +%Y%m%d-%H%M%S) <branch>

matching this repo's existing backup/wallet-engine-20260903 convention. Report the ref name and OLD_TIP in the final summary as the undo path.

  • rerere.enabled is true in this repository, so past resolutions get replayed automatically. That is a hazard, not a convenience — see §6.

3. Start

bash
git -c core.editor=true rebase [--onto ONTO] [REPLAY_BASE] <branch>

If the replayed range contains merge commits, say so and ask whether to flatten them (default) or pass --rebase-merges.

4. How much to read

Keep git's auto-merge. Hunks that do not overlap are merged deterministically and correctly; re-deciding them by hand costs enormously and is less reliable than git, because the failure mode is silently dropping something. Read a whole file only when it is small, or when the conflict cannot be judged from its region alone.

Tier the effort per conflict, judged from one pass over the three stages:

  • Mechanical — both sides append to the same include block, list, enum, .style block or switch; whitespace; adjacent unrelated additions. Read the region, keep both, move on. No history dig.
  • Overlapping logic — both sides changed the same function, the same condition, or the same behavior. Full §5 protocol.

The gap auto-merge leaves is the semantic conflict: hunks that merge cleanly but are wrong together — upstream renamed a symbol this commit calls, changed a signature it passes to, or moved the call site it hooks into. Git never reports these. Cover them cheaply rather than by reading everything:

  • Before --continue, record OLD=$(git rev-parse REBASE_HEAD); after the commit lands, git range-diff $OLD^..$OLD HEAD^..HEAD and read whether the change arrived intact.
  • For a commit that had any conflict, compile the translation units it touched (§5.7). In the native Windows checkout that is ~11s per file and catches nearly all rename and signature drift.
  • The whole-rebase git range-diff in §8 is the net under all of it.

Do not read files that merged cleanly, do not re-review commits that replayed without conflict, and do not build after every commit.

Show full SKILL.md (947 more words)Show less

5. For every conflict: read before you write

Orient once per rebase, because the sides are counter-intuitive during a rebase and getting them backwards silently reverts work:

  • stage 2 = HEAD = --ours = the ONTO side: the new base plus the commits already replayed.
  • stage 3 = REBASE_HEAD = --theirs = the commit being replayed, i.e. the work being moved.

Confirm it once with git show :2:<file> | head against known upstream content before trusting it for the rest of the run.

Then, per conflicted file:

  1. Get the three sides clean. The default marker style hides the base, so read the stages directly rather than parsing markers:
bash
git show :1:<file>   # merge base
git show :2:<file>   # ONTO side
git show :3:<file>   # replayed commit's side

For large files, dump the stages to a temporary location and diff them pairwise. Before you have edited anything you may also re-materialize the conflict with the base included: git checkout --merge --conflict=zdiff3 -- <file>.

  1. Learn the replayed commit's intent.
bash
git log -1 --format='%h %s%n%n%b' REBASE_HEAD
git show REBASE_HEAD -- <file>
git log --oneline REPLAY_BASE..OLD_TIP            # the whole series it belongs to
git log -p REPLAY_BASE..OLD_TIP -- <file>         # its neighbours in that file

A commit is usually one step of a multi-commit design. Resolve for the design, and read the commits that come after this one in the series: if a later commit rewrites the same lines, do not resolve into something it is about to contradict.

  1. Learn the ONTO side's intent.
bash
git log --oneline REPLAY_BASE..ONTO -- <file>
git show <sha> -- <file>                          # for each relevant one, subject + body
git log -L <start>,<end>:<file> REPLAY_BASE..ONTO # history of the exact region

If -L rejects the range, fall back to git log -p REPLAY_BASE..ONTO -- <file>. If the code the commit touched has moved or vanished upstream, find where it went: git log --oneline --diff-filter=RD REPLAY_BASE..ONTO -- <file> and git log -S<symbol> REPLAY_BASE..ONTO. git blame the surviving region.

  1. State both intents in one sentence each, in the running report, before editing. If you cannot state them, you have not read enough — keep reading.

  2. Resolve by re-applying intent, not text. The result must be what the replayed commit's author would have written had they started from today's upstream code:

    • Upstream refactored, renamed, or moved the code → apply the commit's change in the new shape and the new location.
    • Upstream already does the same thing differently → keep upstream's version and add only what is genuinely still missing.
    • Both sides add to the same list, switch, enum or .style block → keep both entries in a sensible order.
    • Upstream deleted what the commit modified → apply the behavior where it lives now; never resurrect deleted code to host a patch.
    • New glue code you have to write follows AGENTS.md and REVIEW.md — no narrating comments, auto, u"..."_q, existing naming.
  3. Genuine contradiction → ask. A contradiction is not "this is hard"; it is two goals that cannot both hold: upstream removed the feature the commit extends, upstream changed the semantics the commit depends on, or both sides changed the same user-visible behavior in opposite directions. Then ask, giving the file and region, one sentence per intent naming the commits that establish them, and 2–4 concrete directions (keep upstream's behavior and drop this hunk / port the change onto the new semantics / keep both under a condition / …). Never guess when the guess would silently change product behavior. Equally, never ask about a mechanical conflict you could have resolved by reading.

  4. Verify, then stage.

bash
grep -nE '^(<{7}|={7}|>{7})' <file>            # must print nothing
git diff -- <file>                              # read the final region
git diff REBASE_HEAD^ REBASE_HEAD -- <file>     # every part of the original change accounted for?
git add <file>

In the native Windows checkout, a non-trivial .cpp resolution is worth the ~11s single translation unit compile:

bash
"/c/Program Files/Microsoft Visual Studio/18/Community/MSBuild/Current/Bin/MSBuild.exe" \
  "C:\Telegram\tdesktop\out\Telegram\Telegram.vcxproj" \
  -t:ClCompile -p:SelectedFiles="C:\Telegram\tdesktop\Telegram\SourceFiles\<rel\path>.cpp" \
  -p:Configuration=Debug -m -nologo -v:minimal 2>&1 | grep -iE "error|warning C" | head

The WSL checkout has no cheap per-file equivalent — its Docker build is the whole app — so there, lean on reading and on §8 instead of compiling.

Then git -c core.editor=true rebase --continue.

6. Two traps

rerere. When git prints Resolved '<path>' using previous resolution, that file was resolved from a recorded past resolution and staged without anyone reading it. Treat it as a conflict that arrived pre-filled: run §5 steps 2–4 on it and read git diff --cached -- <path>. If it is wrong, git rerere forget <path> drops the recording and restores the conflicted state; resolve it by hand from there.

Empty commits. If a commit's change is already upstream, git reports the patch as empty. Confirm it by comparing the commit's intended end state against ONTO — not by the fact that the diff is empty — then git rebase --skip and record the skip with its evidence in the report. A hard conflict is never a reason to skip.

7. Resume

Entered on continue, or when §2 found a rebase already in progress. Rebuild the picture before touching anything: git status, git log -1 REBASE_HEAD, git log --oneline ONTO..HEAD, and .git/rebase-merge/ for the todo list and the original head. Recover the running report if this session wrote one; otherwise reconstruct it from the log. Then continue at §5.

If the state is one you do not understand, stop and report it as it stands. Do not abort to tidy up — the user may want to inspect it, and the backup ref makes recovery cheap either way.

8. Verify the whole rebase

bash
git range-diff REPLAY_BASE..OLD_TIP ONTO..HEAD

Read it commit by commit. Every commit should map 1:1; investigate each one marked with a changed diff and every commit that disappeared. This is the check that the rebase preserved intent, so do not skip it and do not report success before reading it.

Then git log --oneline ONTO..HEAD and git status. Build only when the user asks or when the resolutions were substantial — the checkout's Debug build per AGENTS.md, in the background — and report the real result, failures included.

9. Report

  • The command that ran, and the backup ref plus OLD_TIP sha as the undo path (git reset --hard <backup-ref>).
  • Commits replayed / skipped, with the reason for each skip.
  • One line per conflict: file, the two intents, the resolution chosen.
  • Every question asked and the answer that decided it.
  • Anything resolved with lower confidence, named explicitly so the user can look at it.
  • If the branch was published, state that it now needs a force-push — and do not perform it.

Do not commit or push anything beyond what the rebase itself writes.

© telegramdesktop, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/rebase of telegramdesktop/tdesktop.

Open the folder on GitHubat commit f23c378

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in telegramdesktop/tdesktop, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Rebase next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rebase compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rebase this skilltelegramdesktop/tdesktop33k1 repos~3.7kAutomated safety check: PassGPL-3.0
Keen Pbr Release Postmaksimkurb/keen-pbr139—~844Automated safety check: PassGPL-3.0
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Code Design Rationale Investigatorcursor/plugins10k9 repos~2.6kAutomated safety check: PassNone
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Migrate Internal Package into GhostTryGhost/Ghost55k—~3.8kAutomated safety check: PassMIT

Similar skills

  • Keen Pbr Release Post

    maksimkurb/keen-pbr

    Draft keen-pbr release posts for GitHub and Telegram from git history.

    139 GitHub stars~844 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Official

    Digs into why code is shaped the way it is by checking git history, pull requests and connected tools in parallel, then reporting a cited read on the tradeoffs.

    10k GitHub starsUsed in 9 repos~2.6k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.

    55k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed

More from telegramdesktop/tdesktop

  • Process Inbox

    telegramdesktop/tdesktop

    Process the local ignored ai-tdesktop inbox into durable, independently testable Telegram Desktop task records while task execution worktrees remain active.

    33k GitHub starsUsed in 2 repos~4.5k tokens
    Auto-check passed
  • Perform Task

    telegramdesktop/tdesktop

    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.

    33k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Continue

    telegramdesktop/tdesktop

    Continue autonomous Telegram Desktop development from the shared ai-tdesktop repository.

    33k GitHub starsUsed in 2 repos~9.4k tokens
    Auto-check passed

Works with

Categories

Questions about Rebase

What does Rebase do?

Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear. Rebase is an agent skill from telegramdesktop/tdesktop. Drive an intent-aware rebase of the current checkout, resolving every conflict by reading the history behind both sides instead of by making the markers disappear.

When should I use Rebase?

Rebase fits situations like: the user invokes $rebase; asks to rebase a branch onto another ref; move the tail of a branch onto a new base; abort a rebase that is already in progress.

How do I install Rebase in Claude Code?

Run `npx skills add telegramdesktop/tdesktop --skill rebase -a claude-code`. Or copy the skill folder (.agents/skills/rebase in telegramdesktop/tdesktop) into .claude/skills/rebase in your project. Claude Code loads it when a task matches its description.

How do I install Rebase in Codex?

Run `npx skills add telegramdesktop/tdesktop --skill rebase -a codex`. Or copy the skill folder (.agents/skills/rebase in telegramdesktop/tdesktop) into .agents/skills/rebase in your project. Codex loads it when a task matches its description.

Can I use Rebase in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add telegramdesktop/tdesktop --skill rebase -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rebase, .gemini/skills/rebase, .github/skills/rebase and .opencode/skills/rebase in your project.

What does Rebase need to run?

Going by SKILL.md and its folder, Rebase needs the command-line tools its instructions call (git).

Does Rebase access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Rebase safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rebase use?

Rebase is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rebase use?

About 3.7k tokens (SKILL.md is roughly 15k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rebase?

Skills that share tags, products or a category with Rebase: Keen Pbr Release Post (maksimkurb/keen-pbr, 139 stars), Finishing a Development Branch (obra/superpowers, 296k stars), Code Design Rationale Investigator (cursor/plugins, 10k stars) and Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rebase?

telegramdesktop (a GitHub organization) maintains it in telegramdesktop/tdesktop, which has 33,126 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 6, 2026.

Source: telegramdesktop/tdesktop on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.