branch-rebaser
Skill1 starsChanged 5 days agoMITView on GitHub
Rebase the current branch onto its base and walk every conflict methodically, resolving each by understanding both sides. Use when your feature branch has fallen behind main and you want a clean, linear history without clobbering changes.
- Deletes or force-pushes
- Commits and pushes
In this repository163 other files it gives its agents.
- agents.mdAGENTS.md
- 3d-asset-handoff-sheetSkill
- accessibility-regression-auditorSkill
- adr-writerSkill
- agent-memory-designerSkill
- agent-trajectory-evaluatorSkill
- alerting-rules-tunerSkill
- analysis-memo-writerSkill
- annotation-disagreement-ledgerSkill
- annotation-task-spec-builderSkill
- api-deprecation-plannerSkill
- api-error-contract-designerSkill
- architecture-diagram-generatorSkill
- asset-metadata-review-ledgerSkill
- auth-flow-reviewerSkill
- background-job-reliability-auditorSkill
- brand-voice-profilerSkill
- bundle-analyzerSkill
- cache-policy-designerSkill
- canary-release-plannerSkill
- caption-correction-ledgerSkill
- changelog-from-prsSkill
- chart-chooserSkill
- chunking-strategy-optimizerSkill
- circular-dependency-breakerSkill
- claude-settings-auditorSkill
- code-example-verifierSkill
- cold-email-deliverability-auditorSkill
- cold-start-optimizerSkill
- commit-splitterSkill
- competitor-teardownSkill
- component-spec-writerSkill
- connection-pool-tunerSkill
- content-repurposerSkill
- contract-obligation-registerSkill
- contract-test-designerSkill
- conventional-commitsSkill
- cors-configuratorSkill
- coverage-gap-finderSkill
- crm-export-auditorSkill
- dashboard-designerSkill
- data-retention-auditorSkill
- dataset-first-lookSkill
- dead-code-finderSkill
- deadlock-diagnoserSkill
- decision-log-reconcilerSkill
- dependency-auditSkill
- dependency-upgrade-plannerSkill
- design-brief-writerSkill
- design-critique-checklistSkill
- design-token-extractorSkill
- devcontainer-designerSkill
- distributed-tracing-instrumenterSkill
- dockerfile-optimizerSkill
- email-sequence-drafterSkill
- embedding-index-tunerSkill
- embedding-set-inspectorSkill
- entity-match-candidate-ledgerSkill
- exit-ticket-builderSkill
- extract-moduleSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
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
- Distinctive: line 21
Confirm a clean tree: Run git status --porcelain and git rev-parse --abbrev-ref HEAD.
- Distinctive: line 22
Fetch the latest base: Run git fetch origin --prune so you rebase onto what truly exists upstream, not a stale local ref.
- Very specific: line 24
Prefer the configured upstream: git rev-parse --abbrev-ref @{upstream} (e.g.
- Very specific: line 27
Start the rebase: Run git rebase origin/<base>.
- Very specific: line 29
Read the file and locate the <<<<<<< / ======= / >>>>>>> markers.
- Distinctive: line 33
Continue, and repeat per commit: Run git rebase --continue.
- Distinctive: line 67
Keep *both* intentions — adopt the upstream rename and carry your new key onto it:
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bring the current branch up to date by rebasing it onto its base, replaying your commits one at a time on top of the latest upstream. The skill confirms the working tree is clean before touching anything, fetches the real base, then steps through conflicts deliberately — reading both versions of each hunk and reconstructing the intended result rather than blindly accepting one side — and finishes by rebuilding and re-running tests so you know the rebase preserved behavior, not just resolved markers.
When to use this skill
- Your feature branch has fallen behind
main/masterand you want a linear history instead of a merge commit. - A rebase is mid-flight with conflicts and you want each one resolved by intent, not by reflexively picking
--oursor--theirs. - You need the branch updated before opening or refreshing a PR, and CI must still pass afterward.
[!NOTE] Rebasing rewrites commit SHAs. Only rebase branches you own. If others have based work on this branch or it is already shared, prefer a merge — or coordinate before rewriting history.
Instructions
- Confirm a clean tree. Run
git status --porcelainandgit rev-parse --abbrev-ref HEAD. If there are uncommitted changes, stop and have the user commit or stash them (git stash push -u) before proceeding — a rebase over a dirty tree loses work. Note the current branch name. - Fetch the latest base. Run
git fetch origin --pruneso you rebase onto what truly exists upstream, not a stale local ref. - Identify the base — do not guess. Detect it instead of assuming
main:- Prefer the configured upstream:
git rev-parse --abbrev-ref @{upstream}(e.g.origin/main). - Fall back to the repo's default branch:
git symbolic-ref refs/remotes/origin/HEAD→ strip toorigin/<branch>. - Confirm the branch is actually behind:
git rev-list --left-right --count HEAD...origin/<base>. If the right-hand count is0, it's already up to date — report that and stop.
- Prefer the configured upstream:
- Start the rebase. Run
git rebase origin/<base>. If it completes with no conflicts, skip to step 7. - Resolve each conflict by understanding both sides. For every conflicted file (
git diff --name-only --diff-filter=U):- Read the file and locate the
<<<<<<</=======/>>>>>>>markers. The top block (HEAD/ours) is the base's version; the bottom block (theirs) is your commit being replayed. - Inspect both versions in isolation when unclear:
git show :2:<file>(ours) andgit show :3:<file>(theirs). - Reconstruct the intended result so both changes survive — keep the upstream fix and your feature edit. Never delete a side just to clear the markers.
- Edit the file to the merged result, remove all conflict markers, then
git add <file>.
- Read the file and locate the
- Continue, and repeat per commit. Run
git rebase --continue. Conflicts surface one replayed commit at a time, so return to step 5 for each new batch. If a commit becomes empty after resolution,git rebase --skipit. Usegit rebase --abortto return to the pre-rebase state if anything looks wrong. - Verify by building and testing. Resolved markers are not proof of correctness. Run the project's build and test commands (detect them — e.g.
npm run build && npm test,pytest,go build ./... && go test ./...). Fix any breakage the rebase introduced. - Report and flag gaps. Summarize how many commits replayed, which files conflicted and how each was resolved, and whether build/tests pass. Surface anything that needs a human eye (semantic conflicts the test suite may not catch, skipped commits). Do not force-push unless explicitly told to (see warning).
[!WARNING] Updating a remote branch after a rebase requires a force-push, which rewrites history others may have pulled. Always use
git push --force-with-lease(never bare--force) so you fail safely if the remote moved. If the branch is shared or backs an open PR with other contributors, confirm with the user first before pushing.
Examples
A conflict-resolution loop on a branch two commits behind origin/main:
$ git status --porcelain # clean tree, ok to proceed
$ git fetch origin --prune
$ git rev-list --left-right --count HEAD...origin/main
3 2 # 3 local commits, 2 upstream → behind, rebase
$ git rebase origin/main
Auto-merging src/config.ts
CONFLICT (content): Merge conflict in src/config.ts
error: could not apply 1f4a2b9... feat(config): add retry optionsrc/config.ts shows both sides — upstream renamed the timeout field; your commit added a sibling key:
<<<<<<< HEAD # ours: upstream's rename
requestTimeoutMs: 5_000,
======= # theirs: your new feature
timeout: 5000,
retries: 3,
>>>>>>> 1f4a2b9 (feat(config): add retry option)Keep both intentions — adopt the upstream rename and carry your new key onto it:
requestTimeoutMs: 5_000,
retries: 3,$ git add src/config.ts
$ git rebase --continue
[detached HEAD 9c1d0e2] feat(config): add retry option
Successfully rebased and updated refs/heads/feat/retry.
$ npm run build && npm test # verify behavior, not just markers
✓ build passed ✓ 142 tests passed
$ git push --force-with-lease # only after confirming the branch isn't sharedReported: 3 commits replayed, 1 conflict in src/config.ts (resolved by adopting the upstream requestTimeoutMs rename while carrying retries), build and tests green.
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
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.

