git-rebuild-branch
Skill1 starsChanged 10 days agoMITView on GitHub
Rebuild a git branch by cherry-picking only its unique commits onto another branch, e.g. a feature branch onto main minus inherited commits.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- vladcheck/skillsword for word, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 1
- vladcheck/skills★ 1100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- analyze-session-pingpong-logsSkill
- create-glossarySkill
- deepseek-reasoning-tier-clarifierSkill
- defineSkill
- find-alternativesSkill
- get-note-links-from-textSkill
- gitlab-eas-tickets-publishSkill
- gitlab-mr-roundtripSkill
- git-sequentialSkill
- gost-report-rebuildSkill
- mattpocock-skills-researchSkill
- mirea-moodle-downloadSkill
- obsidian-add-links-to-noteSkill
- opsx-spec-validateSkill
- paretto-principleSkill
- publish-spec-gitlab-milestoneSkill
- publish-tickets-gitlabSkill
- solidSkill
- update-skills-via-skills-shSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
If any of the first two is missing, ask the user before proceeding.
- Very specific: line 25
No ignore branch: <target>..<source> (commits in source, not in target).
- Distinctive: line 53
Do NOT run anything until the user approves.
- Very specific: line 54
Execute one command at a time: Run each command as a separate invocation.
- Very specific: line 56
If cherry-pick hits a conflict, stop and surface it — resolve, then git cherry-pick --continue.
- Distinctive: line 81
Prefer the earliest recovery point: the further you get, the more you rely on the saved SHA / reflog.
- Very specific: line 87
Deleting the source branch before the rebuild succeeds: Only run git branch -D <source> after all cherry-picks land.
- Very specific: line 88
Skipping the preview: Always show git log --oneline <range> so the commit selection is confirmed before any destructive step.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
git-rebuild-branch
Rebuild a branch by cherry-picking only the commits that are unique to it onto a target branch, then swap the rebuilt branch back into place under the original name.
Inputs (collect all before acting)
- Target branch — the branch to cherry-pick onto (e.g.
main). - Source branch — the branch whose commits you want (e.g.
B). - Ignore branch (optional) — a branch whose commits must be excluded (e.g.
A). Givenmain -> A -> B, ignoringAkeeps commits inBthat are NOT inA.
If any of the first two is missing, ask the user before proceeding.
Commit range
- Ignore branch given:
<ignore>..<source>(commits in source, not in ignore). - No ignore branch:
<target>..<source>(commits in source, not in target).
git cherry-pick <range> applies these oldest-first automatically.
Workflow
- Preview the commits so the user can confirm they are correct:
git log --oneline <range> - Build the command list using a temporary branch name (
<source>-rebuilt). Every command below is mandatory and part of the sequence — the safety anchor and verifications are not optional extras:git log --oneline <range> git rev-parse <source> git checkout <target> git rev-parse --abbrev-ref HEAD git checkout -b <source>-rebuilt git cherry-pick <range> git status git log --oneline <target>..HEAD git branch -D <source> git branch --list <source> git branch -m <source>-rebuilt <source> git log --oneline <target>..<source> Get approval. Present exactly:
Here is what I'm going to do:
<commands>Do you approve this?Do NOT run anything until the user approves.
- Execute one command at a time. Run each command as a separate invocation. Never chain with
&&,;, or||. After each command, confirm its result matches the table below before running the next. - Save the output of
git rev-parse <source>(step 2, second command) — this SHA is the backtracking escape hatch. - If
cherry-pickhits a conflict, stop and surface it — resolve, thengit cherry-pick --continue. Never--skipor--abortwithout asking.
Expected result per command
| Command | Expect |
git rev-parse <source> | a SHA — save it (backtracking anchor) |
git checkout <target> → next git rev-parse --abbrev-ref HEAD | <target> |
git checkout -b <source>-rebuilt | branch created; HEAD is <source>-rebuilt |
git cherry-pick <range> → git status + git log --oneline <target>..HEAD | clean tree; same commits (minus SHAs) as the preview |
git branch -D <source> → git branch --list <source> | empty |
git branch -m <source>-rebuilt <source> | <source> exists, <source>-rebuilt gone |
Final git log --oneline <target>..<source> | exactly the intended commits |
Backtracking
The saved SHA from git rev-parse <source> lets you undo everything — the original commits are not garbage-collected while that SHA is known.
| Situation | Recovery |
| Cherry-pick conflict you don't want to resolve | git cherry-pick --abort, then git checkout <target> and delete the temp branch — original <source> is untouched. |
| Rebuilt branch looks wrong, source NOT yet deleted | git checkout <source>; git branch -D <source>-rebuilt. Nothing lost. |
| Already deleted/renamed and result is wrong | git branch -f <source> <saved-SHA> to restore the original, then remove the bad branch. |
| Lost the SHA too | git reflog — find the pre-rebuild <source> entry and git branch -f <source> <reflog-SHA>. |
Prefer the earliest recovery point: the further you get, the more you rely on the saved SHA / reflog.
Common mistakes
- Wrong range direction.
A..B= commits reachable from B but not A. Reversing it drops everything you wanted. - Chaining commands. The user requires one command per invocation; a chained failure leaves the repo half-migrated.
- Deleting the source branch before the rebuild succeeds. Only run
git branch -D <source>after all cherry-picks land. - Skipping the preview. Always show
git log --oneline <range>so the commit selection is confirmed before any destructive step.
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.

