git-workflow
Skill0 starsChanged 2 months agoMITView on GitHub
Worktree-per-change git flow — create a worktree and branch for a feature or bug, commit to it, rebase onto the base branch, push, and hand off a pull request. Use when starting any new feature or bug fix, and when finishing one. Covers worktree setup, branch naming, safe rebasing, conflict handling, and the PR handoff. Claude never merges to the base branch unless the repo opted out with .claude/allow-merge-to-base.
- Deletes or force-pushes
- Commits and pushes
118 other projects use a version of this.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- NinjaSln-labs/agent-skillstheir own version, first seen Oct 2, 2026
- 1pedroosilva/databricks-genie-skillstheir own version, first seen Oct 2, 2026
- vospr/context-engineering-templatetheir own version, first seen Oct 1, 2026
- fusebase-dev/fusebase-flowtheir own version, first seen Oct 1, 2026
Used with
Projects with it also use squad-commands, typescript-patterns 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.
MicrosoftSkillsquad-commands
Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.
Also in 3 projects that use this
cohen-lielSkilltypescript-patterns
TypeScript best practices and patterns. Use when writing TypeScript code, defining types, working with generics, or converting JavaScript to TypeScript.
Also in 4 projects that use this
martinholovskySkillllm-integration
Expert skill for integrating local Large Language Models using llama.cpp and Ollama. Covers secure model loading, inference optimization, prompt handling, and protection against LLM-specific vulnerabilities including prompt injection, model theft, and denial of service attacks.
Also in 4 projects that use this
MicrosoftSkillcost-optimization
Optimize existing Azure resources and analyze Reservations or Savings Plans. WHEN: \"optimize Azure costs\", \"reduce cloud spending\", \"rightsize resources\", \"find idle resources\", \"orphaned disk\", \"deleted VM still charged\", \"public IP still charging\", \"reservation utilization\", \"Savings Plan coverage\", \"commitment recommendation\", \"why is pay-as-you-go still charged\". DO NOT USE FOR: cost spikes, forecasts, pricing estimates, budgets, or governance.
Also in 5 projects that use this
YepAPISkillbackground-jobs
Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.
Also in 3 projects that use this
Vimalk0703Skilldependency-management
Vet packages before adoption, audit for vulnerabilities, pin versions, and prevent dependency bloat.
Also in 3 projects that use this
- +1 more from microsoft
Other versions118 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 118
- JetBrains/ideavim★ 10ksame name
- Galaxy-Dawn/claude-scholar★ 5.7ksame name
- github/gh-aw★ 5.3ksame name
- microsoft/Generative-AI-for-beginners-dotnet★ 3.1ksame name
- microsoft/waza★ 1.4ksame name
- laolaoshiren/claude-code-skills-zh★ 876same name
- Mindrally/skills★ 266same name
- Azure/fleet★ 226same name
- povvo/claudikins-kernel★ 128same name
- extra-org/extra★ 113same name
108 more not listed
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 repository9 other files it gives its agents.
- brainstormingSkill
- commit-messageSkill
- dev-verifySkill
- diff-reviewSkill
- env-doctorSkill
- fix-bugSkill
- refactorSkill
- ship-featureSkill
- workSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 101 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Create the worktree as a sibling of the repo, then work inside it.
- Distinctive: line 59
Do every later step from inside this folder.
- Very specific: line 75
Follow the commit-message skill: one line, type: summary, no body.
- Very specific: line 98
Don't use --autostash: it hides dirty state you should handle deliberately, and reapplying it can conflict.
- Distinctive: line 121
Not detached: git symbolic-ref -q HEAD succeeds
- Very specific: line 122
No rebase in progress: no .git/rebase-merge/ or .git/rebase-apply/
- Very specific: line 131
Never bare --force: it overwrites teammates' commits unconditionally.
- Distinctive: line 135
No remote? Skip the push, say so, and report the branch name instead.
- Distinctive: line 139
Only when the marker above is present.
- Distinctive: line 170
Leave the worktree in place — the user may want to look at it.
“Common” is measured: kept by at least 6 in 10 of the 101 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.
Files
Worktree → commit → rebase → push → PR
Full conventions: ${CLAUDE_PLUGIN_ROOT}/conventions/git.md. This skill is the
procedure.
The boundary: you take work to ready-for-PR and stop. You never commit to the base branch, never push to it, and never merge into it. Three hooks enforce this. If one blocks you, it is working correctly — don't route around it.
Unless the repo opted out. A repo with .claude/allow-merge-to-base in its
main checkout has said the pull request is ceremony it doesn't want — solo
project, no reviewer on the other side. There, finish by merging instead of
handing off. Check once, at the start:
test -f "$(git rev-parse --path-format=absolute --git-common-dir)/../.claude/allow-merge-to-base"Pushing to the base is still blocked either way, so merged work stays local until the user pushes it themselves. Say so when you hand back.
Finding the base branch
Never assume main:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/default-branch.sh"- exit 0 → the name is on stdout. Use it.
- exit 3 → ambiguous; candidates printed. Ask the user. Do not pick. If
a remote exists, the real fix is
git remote set-head origin -a. - exit 1 → no branches yet; nothing to branch from.
Starting work
Create the worktree as a sibling of the repo, then work inside it. Unlike
git switch, git worktree add does not touch the current folder — it
never changes the user's branch and is safe even with a dirty tree, because the
new worktree is checked out fresh from the base.
BASE=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/default-branch.sh") || exit
git fetch origin --prune # skip entirely if there is no remote
REPO=$(basename "$(git rev-parse --show-toplevel)")
# The folder name flattens the branch's "/" to "-" so it stays one sibling dir.
git worktree add "../$REPO-feat-short-description" -b feat/short-description "origin/$BASE"
cd "../$REPO-feat-short-description" # use "$BASE" not "origin/$BASE" if no remoteDo every later step from inside this folder.
Because the worktree starts from the base, uncommitted work in the user's main folder stays behind. If they meant that work to be part of this change, stop and ask before proceeding.
Branch names
type/kebab-case-description — 2–5 words, lowercase and hyphens. Use feat/,
not feature/, matching the commit types.
feat/add-password-reset · fix/null-user-response ·
refactor/extract-fetch-logic · chore/bump-prisma
Committing
Follow the commit-message skill: one line, type: summary, no body. A hook
rejects anything else.
Rebasing onto the base
First, check the branch isn't shared. Rebasing rewrites hashes; if anyone has pulled these commits, their next pull produces duplicate, conflicting history. Treat as shared if either succeeds:
git rev-parse --abbrev-ref 'HEAD@{upstream}' 2>/dev/null # has upstream => pushed
git branch -r --contains HEAD # non-empty => publishedShared → stop and ask. Do not rebase autonomously.
Otherwise:
git fetch origin --prune # skip if no remote
git rebase "origin/$BASE" # or "$BASE" if no remoteDon't use --autostash: it hides dirty state you should handle deliberately,
and reapplying it can conflict.
On conflict
Rebase exits 1 and leaves .git/rebase-merge/. List what conflicted:
git diff --name-only --diff-filter=UDefault action: git rebase --abort, then report the conflicting files to
the user. That restores the branch and a clean tree exactly.
- Never
git rebase --skip— it silently discards a commit. - Resolve without asking only when the conflict is unambiguous and the result can be validated by the project's checks. Anything else is the user's call.
Pushing
Preconditions — check all of them, and if one fails, say which and stop:
git status --porcelainis empty- Not detached:
git symbolic-ref -q HEADsucceeds - No rebase in progress: no
.git/rebase-merge/or.git/rebase-apply/ - Base freshly fetched, and the branch rebased onto it
- Verification passed — see
${CLAUDE_PLUGIN_ROOT}/conventions/testing.md
git push -u origin feat/short-description # first push
git push --force-with-lease --force-if-includes # after a rebaseNever bare --force: it overwrites teammates' commits unconditionally.
--force-with-lease alone is fooled by a bare git fetch, which updates the
tracking ref without integrating — --force-if-includes covers that.
No remote? Skip the push, say so, and report the branch name instead.
Finishing: merge, in an opted-out repo
Only when the marker above is present. Rebase onto the current base first — it moves — then confirm the main checkout is where you think it is, in one command, and abort unless it is:
git -C ../<repo> branch --show-current && git -C ../<repo> rev-parse HEAD
git -C ../<repo> merge --ff-only feat/short-description--ff-only refuses if the base moved again: rebase again and retry rather than
forcing it. Then clean up after yourself — the merge keeps every commit, so
removing the worktree only discards the folder:
git worktree remove ../<repo>-feat-short-description
git branch -d feat/short-description # -d, never -DHanding off the pull request
Everywhere else, this is where you stop. Report what landed on the branch and give the user the command:
gh pr create --base <base> --head <branch> --title "type: summary" --body "..."Include in your report: the branch, the base, the files changed, what
verification actually ran, and what the reviewers said. For anything visual,
add a dev-verify checklist.
Leave the worktree in place — the user may want to look at it. If they confirm the PR is merged and ask you to clean up:
git worktree remove ../<repo>-feat-short-description
git branch -d feat/short-description # -d, never -D-d refuses to delete a branch whose commits aren't reachable from the base, so
a refusal is real information: the merge didn't land what you thought. -D
deletes unconditionally and discards the commits.
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.

