git-workflow
Skill0 starsChanged 46 days 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
188 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- kinhluan/skillstheir own version, first seen Nov 8, 2026
- juninmd/skillstheir own version, first seen Nov 8, 2026
- jDxve/avengers-kittheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- haythamasalama/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use squad-commands, ci-cd-pipelines 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.
Microsoft AzureSkillsquad-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 5 projects that use this
harrissohail6Skillci-cd-pipelines
CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.
Also in 6 projects that use this
Microsoft AzureSkillarchitectural-proposals
How to write comprehensive architectural proposals that drive alignment before code is written
Also in 4 projects that use this
GitHubSkille2e-template-testing
End-to-end validation of coordinator and agent template changes
Also in 3 projects that use this
GitHubSkillnotification-routing
Route agent notifications to specific channels by type — prevent alert fatigue from single-channel flooding
Also in 3 projects that use this
frostneySkillnative-nostalgia-stack
Applies the user's FreePascal toolchain and its build, formatting, hook, and test contracts while leaving project-specific mechanics local. Use when scaffolding or working in a FreePascal project that follows this toolchain.
Also in 3 projects that use this
- +5 more from Azure
- +1 more from github
Other versions188 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 188
- langfuse/langfuse★ 37ksame name
- modelcontextprotocol/typescript-sdk★ 14ksame name
- JetBrains/ideavim★ 10ksame name
- jokob-sk/NetAlertX★ 7.4ksame name
- netalertx/NetAlertX★ 7.4ksame name
- Galaxy-Dawn/claude-scholar★ 5.9ksame name
- github/gh-aw★ 5.6ksame name
- modelcontextprotocol/csharp-sdk★ 4.6ksame name
- antonbabenko/pre-commit-terraform★ 3.8ksame name
- github/squad★ 3.4ksame name
178 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 165 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 165 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.

