git-branch-create
Skill3 starsChanged 23 days agoMITView on GitHub
Create a short-lived branch (feature/*, bugfix/*, hotfix/*, release/*) named per the repo's .gitmessage rules and cut from the correct base, after a choice-question confirmation. Use when starting a new feature, fix, hotfix, or release, or when asked how to name a branch. Never fetches or pulls; for a base refresh it suggests git-pull.
- Reads credentials
- Deletes or force-pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- pivoshenko/pivoshenko.aitheir own version, first seen Nov 12, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- pivoshenko/pivoshenko.ai★ 6same name
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 repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- git-branch-deleteSkill
- git-commitSkill
- git-fetchSkill
- git-mergeSkill
- git-pullSkill
- git-pushSkill
- git-tagSkill
- hf-downloadSkill
- hf-setupSkill
- hf-uploadSkill
- py-env-setupSkill
- repo-docsSkill
- repo-initSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 7 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Create a properly-named local branch off the correct base, following the repo's .gitmessage branch-management spec.
- Distinctive: line 23
Neither: ask with a choice question at steps 3 and 4.
- Distinctive: line 31
Run every command in this skill in a POSIX shell.
- Very specific: line 33
Read the spec: Read .gitmessage at the repo root for the allowed branch types, the naming variant in use, and the protected-branch list.
- Distinctive: line 35
Gather state: Run these independent reads:
- Very specific: line 62
No spaces, underscores, uppercase, accents, or non-ASCII.
- Very specific: line 79
commit-first (Recommended): STOP and suggest git-commit so the pending edits land on the current branch.
- Distinctive: line 80
abort: STOP. The user keeps the pending edits and decides separately.
- Very specific: line 100
NEVER create a branch with a protected name: main, develop, or anything matching support/*, compared ignoring case (Main and Support/x …
- Distinctive: line 101
NEVER create a name that differs only by case from an existing local or origin branch, and NEVER cut from a base whose exact spelling step …
- Very specific: line 102
NEVER drop --no-overwrite-ignore from the step-7 command.
- Very specific: line 103
NEVER create a branch in a zero-commit repository.
- Very specific: line 105
NEVER git fetch, git pull, or otherwise refresh the base ref from inside this skill.
- Very specific: line 106
NEVER discard uncommitted work to switch bases.
- Distinctive: line 107
NEVER skip the step 7 choice question.
- Very specific: line 108
NEVER push the branch. Publishing belongs to git-push.
- Distinctive: line 109
If the user's proposed name violates the naming rules, suggest a corrected version and confirm with a choice question before using 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
Goal
Create a properly-named local branch off the correct base, following the repo's .gitmessage branch-management spec.
When NOT to use
- The user wants the base refreshed from origin first: suggest
git-pullwith<base>, then re-run this skill. - The user wants the new branch published: that is
git-push. - The user wants a long-lived line (
main,develop,support/*): out of scope, refuse per Hard rules.
Prerequisites
Resolve the branch name and the base before step 1, in this priority order. Whatever the source, the resulting name still passes step 5 validation and the step 7 gate.
- Caller-supplied: another skill invoked this one and passed arguments, for example
git-commitstep 3f passing<name> base=<ref>. Take the candidate name and the base verbatim. - User text in the current turn ("start a feature branch for X", "branch off main"): parse the type, name, and base from it.
- Neither: ask with a choice question at steps 3 and 4.
When the caller is git-commit's rescue path, the supplied base is always the current HEAD, so step 6 takes the "HEAD already equals base" path and the dirty-tree prompt never fires (on a detached HEAD the caller passes the literal base=HEAD). Do NOT substitute main or develop for a caller-supplied base; see Hard rules.
Procedure
Terms such as choice question, independent reads, invoke, and suggest follow AGENTS.md (Skill authoring); in a non-interactive session every gate ends this skill.
Run every command in this skill in a POSIX shell; the redirections used across this skill family are POSIX syntax and break under PowerShell.
- Read the spec. Read
.gitmessageat the repo root for the allowed branch types, the naming variant in use, and the protected-branch list. Fall back to the defaults below when it is absent. - Gather state. Run these independent reads:
git branch --show-current(current branch; empty output means detached)git rev-parse --verify --quiet HEAD(empty output means the repository has no commits yet; consumed by step 6)git for-each-ref --format='%(refname)' refs/heads/ refs/remotes/origin/(existing local and origin branches as stored; consumed by the step-5 collision check)git status --short(dirty check consumed by step 6)
Choose the branch type and its base. The default base follows the
Workflow:line in.gitmessage's "Workflow Variant" section; when no variant is declared, or the line carries an unrecognized value (such as the shipped<not recorded>placeholder), assumegit-flow. If the user did not say which type, ask with a choice question:Type Purpose Base under git-flowBase under github-flow/trunk-solofeature/*new functionality developmainbugfix/*non-urgent defect fix for the next release developmainhotfix/*urgent fix against production mainmainrelease/*release stabilization developmainA caller-supplied
base=from the Prerequisites always overrides this table.support/*is a long-lived maintenance line for a previous major and is NOT creatable here; see Hard rules. Undertrunk-solobranches are optional rather than mandatory, but an explicit invocation of this skill means the user wants one, so proceed normally.Choose the naming variant per
.gitmessage's "Branch Naming" section:- Variant A:
<type>/<issue-id>-<short-desc>(an issue tracker is the source of truth; the id is lowercased, so tracker idPROJ-123becomesfeature/proj-123-<short-desc>) - Variant B:
<type>/<scope>/<short-desc>(work organized by module or package) - Variant C:
<type>/<short-desc>(PR titles carry the context)
Read the section's
Adopted:line first; when it names a variant, use it. When it is<not recorded>or absent, infer the dominant variant fromgit branch -a --list 'feature/*' 'bugfix/*' 'hotfix/*' 'release/*' 'origin/feature/*' 'origin/bugfix/*' 'origin/hotfix/*' 'origin/release/*'(with-a, a barefeature/*pattern matches local branches only; theorigin/forms are what match remote-tracking branches, listed asremotes/origin/...); if still ambiguous, ask.- Variant A:
- Validate the name against
.gitmessage's "Naming Character Rules":- Lowercase ASCII letters, digits, and
-only inside path segments. /strictly as the type or scope separator.- No spaces, underscores, uppercase, accents, or non-ASCII. Under Variant A this includes the issue id: suggest the lowercased form (
PROJ-123becomesproj-123), never drop or reformat the id otherwise. - Total length 60 characters or fewer.
- No collision. Compare the name ignoring case against the step-2 ref list:
grep -ixF -e 'refs/heads/<name>' -e 'refs/remotes/origin/<name>'over it. An exactrefs/heads/<name>line means the branch already exists: pick another name. Any line that differs fromrefs/heads/<name>orrefs/remotes/origin/<name>only by case: refuse the name, because on a case-insensitive filesystem the two share one ref file (git reportsalready existsor writes into the other spelling). An exactrefs/remotes/origin/<name>line is no collision. - The lowercased name is not
mainordevelopand does not start withsupport/(see Hard rules).
- Lowercase ASCII letters, digits, and
Verify the base. Unless it is the literal
HEAD(a caller passedbase=HEAD), first require its exact spelling:[ "$(git for-each-ref --format='%(refname)' "refs/heads/<base>")" = "refs/heads/<base>" ](equality, becausefor-each-refalso lists everything under a hierarchy). On a case-insensitive filesystemrev-parseresolvesMainto the loose refmain, so it cannot prove the spelling. When the test fails butgit for-each-ref --format='%(refname:lstrip=2)' refs/heads/ | grep -ixF -e '<base>'lists a name, STOP and report the exact spelling; if the base came from a HEAD switched to under another case (for examplegit-commitpassingMain), suggestgit switch <exact name>first. Then confirm the base resolves withgit rev-parse --verify --quiet <base-ref>, where<base-ref>isrefs/heads/<base>orHEAD. The full ref name matters: an unqualified name resolves to a same-name tag before the branch, and the new branch would silently start from the tag. When it does not resolve at all, tell the two causes apart with the step-2HEADprobe; they need different answers.Unborn stop. On a zero-commit repository (
git symbolic-refnames a branch butgit rev-parse --verify --quiet HEADresolves nothing), STOP and suggestgit-commitfor the repository's first commit. Two tested reasons: no base can resolve, sogit checkout -b <name> <base-ref>is fatal; and the no-base formgit checkout -b <name>"succeeds" by moving the unborn symref, which makes the original trunk cease to exist. The bootstrap commit lands on the trunk viagit-commit's explicit opt-in; branches come after it.Missing base.
HEADresolves but<base>does not: the repository has commits and only the base branch is absent locally (typical: a clone that never checked outdevelop, or thegit-flowdefault applied to a repo that only hasmain). This is NOT an empty repository; do not suggestgit-commit. STOP, report which ref is missing, then:git rev-parse --verify --quiet refs/remotes/origin/<base>resolves: the base exists on origin only. Rendergit branch --track <base> origin/<base>for the user to run themselves (this skill never creates a protected name; see Hard rules), then re-run from step 1.- It does not resolve either: the declared or assumed workflow names a base this repo does not have. Suggest naming the base explicitly in the request (for example "branch off main") or fixing the
Workflow:line in.gitmessage(git-commitstep 3a andrepo-initask the user which variant applies and record the answer; no skill infers it, since.gitmessageforbids guessing).
Dirty-tree check (the base resolves). HEAD equals base when the step-2 current branch name equals
<base>, or when HEAD is detached and<base>is the literalHEAD. A different branch that merely points at the same commit does NOT count as equal.- HEAD already equals base: the working tree is preserved across branch creation regardless of dirty state; no extra prompt is needed.
- Ignored files:
git status --shorthides them, and a plaingit checkout -bsilently overwrites an ignored local file (such as.env) that<base>tracks. The step-7 command carries--no-overwrite-ignore, so git refuses instead (untracked working tree files would be overwritten), creates no branch, and keeps the file; relay that error and let the user move the file. - HEAD differs from base AND
git status --shortis non-empty:git checkout -b <name> <base-ref>would either carry the uncommitted edits onto the new branch cut from<base>(when<base>does not modify the same paths) or refuse outright (when it does). Both are bad surprises, so ask with a choice question with exactly two options:- commit-first (Recommended): STOP and suggest
git-commitso the pending edits land on the current branch; re-run this skill from step 1 afterwards. - abort: STOP. The user keeps the pending edits and decides separately.
- commit-first (Recommended): STOP and suggest
- Show the plan and confirm with a choice question (create / abort). Render the exact command first. Proceed only on an explicit create in the current turn: choosing that option, or typing "create" / "yes create" / "go ahead", counts; ambiguous replies and earlier-turn approval do not. The plan is the same single command whether or not HEAD equals base (a differing base requires a clean tree; step 6 already STOPPED otherwise). It switches straight onto the new branch, so there is no separate
git checkout <base>, which would also fail when<base>is checked out in another worktree:git checkout --no-overwrite-ignore -b <name> <base-ref><name>is the full validated name in the adopted variant's shape and<base-ref>is the step-6 full ref (refs/heads/<base>, orHEAD). - Create the branch. Execute the approved plan verbatim. Report the new branch name and the next step: make commits, then
git-pushwhen ready to publish.
Rationale
- No fetch or pull inside this skill. It keeps the scope to branch creation and prevents moving the base ref without a per-operation confirmation.
git-pullwith<base>carries its own gate for that. - No "switch anyway" option at step 6.
git checkout --andgit reset --hardare forbidden by the Hard rules, and silent stashing is out of scope. - Exact names, compared ignoring case. A case-insensitive filesystem resolves any casing to the one loose ref, so a base typed as
Mainpassesrev-parse, and a newFeature/Xbesidefeature/xshares its ref file;for-each-refequality and case-insensitive comparison catch both. --no-overwrite-ignoreturns git's default of overwriting ignored files into a refusal; losing a local.envto a tracked copy on the base is silent and unrecoverable.- The step-7 gate stays even though
git branch -Dmakes creation cheap to undo, because a mistyped branch name lingers in tooling. It is the cheapest safety net against typos.
Hard rules
- NEVER create a branch with a protected name:
main,develop, or anything matchingsupport/*, compared ignoring case (MainandSupport/xcount). - NEVER create a name that differs only by case from an existing local or origin branch, and NEVER cut from a base whose exact spelling step 6 did not confirm.
- NEVER drop
--no-overwrite-ignorefrom the step-7 command. - NEVER create a branch in a zero-commit repository. The step-6 unborn stop suggests
git-commitfor the bootstrap commit first. - NEVER substitute a different base for a caller-supplied one. A caller that hands over a dirty working tree (
git-commitstep 3f) has already chosen the only base that avoids the step-6 dirty-tree prompt; overriding it withmainordevelopforces step 6 to suggestgit-commitagain, and the two skills ping-pong without progressing. - NEVER
git fetch,git pull, or otherwise refresh the base ref from inside this skill. Suggestgit-pullwith<base>, which gates the fetch and fast-forward itself. - NEVER discard uncommitted work to switch bases. Offer
git-commitfirst;git reset --hardandgit checkout --are forbidden as shortcuts. - NEVER skip the step 7 choice question.
- NEVER push the branch. Publishing belongs to
git-push. - If the user's proposed name violates the naming rules, suggest a corrected version and confirm with a choice question before using it.
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.

