git-branch
Skill2 starsChanged 42 days agoMITView on GitHub
Create a descriptive feature branch from the repo default branch using session context and current git changes
- Deletes or force-pushes
6 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/devsquad-copilottheir own version, first seen Oct 16, 2026
- my-chiefmind/ai-maestrotheir own version, first seen Oct 13, 2026
- cognis-digital/skillsmiththeir own version, first seen Oct 11, 2026
- ZunoSmartLabs/zsl-superpowerstheir own version, first seen Sep 21, 2026
- puku0x/agent-skills-testtheir own version, first seen Apr 19, 2026
- CarpeWu/claude-git-skillstheir own version, first seen Jan 27, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- microsoft/devsquad-copilot★ 50same name
- my-chiefmind/ai-maestro★ 6same name
- ZunoSmartLabs/zsl-superpowers★ 2same name
- puku0x/agent-skills-test★ 1same name
- CarpeWu/claude-git-skills★ 0same name
- cognis-digital/skillsmith★ 0same 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 repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- changelog-bump-verSkill
- gh-copilot-review-readSkill
- gh-copilot-review-resolveSkill
- gh-copilot-reviewSkill
- gh-cr-submitSkill
- gh-issue-fixSkill
- gh-issueSkill
- gh-pr-mergeSkill
- gh-protect-default-branchSkill
- gh-pr-reviewSkill
- gh-prSkill
- gh-releaseSkill
- git-commitSkill
- git-pushSkill
- make-changelogSkill
- mir-skills-installSkill
- mir-skills-updateSkill
- python-venvSkill
- save-planSkill
- session-noteSkill
- work-reportSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. 0 are common, 22 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
22
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Create and switch to the new branch while preserving local changes when safe
- Distinctive: line 17
Ask the user instead of guessing when the intent or safe branching base is ambiguous
- Distinctive: line 21
Use this skill when the user asks to create a new git branch for the current work and wants the branch name derived from the session …
- Distinctive: line 26
Use git switch when available.
- Distinctive: line 28
If the current branch is not the detected default branch and the worktree is dirty, ask the user before switching branches
- Distinctive: line 32
Check the current branch:
- Distinctive: line 43
If the remote default branch is unavailable, fall back in this order:
- Distinctive: line 53
If no default branch can be determined, stop and ask the user which branch should be used as the base.
- Distinctive: line 64
Prefer the user request and session goal over raw filenames when naming the branch.
- Distinctive: line 65
Use changed files and diff summaries as supporting context to infer the branch type and slug.
- Distinctive: line 66
If there are no local changes yet, derive the branch name from the session goal alone.
- Distinctive: line 79
Keep it lowercase and hyphenated
- Distinctive: line 80
Prefer 3-5 words when possible
- Distinctive: line 81
Use the session goal first, with changed files as supporting evidence
- Very specific: line 82
Avoid vague slugs like updates or misc-fixes
- Distinctive: line 88
If the intent is still unclear after reviewing the session and git changes, ask the user for the branch name instead of guessing.
- Distinctive: line 90
If the generated local branch name already exists, append a short numeric suffix until it is unique:
- Distinctive: line 99
If already on the detected default branch, create the new branch directly from the current state:
- Distinctive: line 107
If on a different branch and the worktree is clean, return to the default branch first, then create the new branch:
- Distinctive: line 118
If on a different branch and the worktree is dirty:
- Distinctive: line 119
Do not stash, reset, or discard changes automatically
- Very specific: line 120
Ask the user whether to branch from the current state or first return to <default-branch>
- Distinctive: line 122
After creating the branch, confirm the result:
- Distinctive: line 135
Never use destructive commands like git reset --hard and never discard the user's changes automatically
“Common” is measured: kept by at least 6 in 10 of the 4 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
What I do
- Detect the repository default branch from
origin/HEAD, then fall back to localmain,master, ordevelop - Review the current session context plus staged and unstaged git changes to infer the branch purpose
- Generate a short branch name in
<type>/<brief-description>format - Create and switch to the new branch while preserving local changes when safe
- Ask the user instead of guessing when the intent or safe branching base is ambiguous
When to use me
Use this skill when the user asks to create a new git branch for the current work and wants the branch name derived from the session context and current git changes.
Prerequisites
gitmust be installed- Use
git switchwhen available; if the installed Git is too old to support it, usegit checkout/git checkout -binstead - The repository should have a detectable default branch from
origin/HEADor localmain,master, ordevelop - If the current branch is not the detected default branch and the worktree is dirty, ask the user before switching branches
Default Branch Detection
- Check the current branch:
git branch --show-current - Detect the remote default branch first:
default_branch="$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null)" default_branch="${default_branch#origin/}" - If the remote default branch is unavailable, fall back in this order:
for candidate in main master develop; do if git show-ref --verify --quiet "refs/heads/$candidate"; then default_branch="$candidate" break fi done - If no default branch can be determined, stop and ask the user which branch should be used as the base.
Change Analysis
- Review the current agent session context and the user's latest request.
- Inspect the current git-visible work:
git status --short git diff --cached --stat git diff --stat - Prefer the user request and session goal over raw filenames when naming the branch.
- Use changed files and diff summaries as supporting context to infer the branch type and slug.
- If there are no local changes yet, derive the branch name from the session goal alone.
Branch Name Generation
- Format:
<type>/<brief-description> - Types:
feat/for new capabilities or additionsfix/for bugs, regressions, or broken behaviordocs/for documentation-only worktest/for test-only workrefactor/for structural changes without intended behavior changeschore/for maintenance, tooling, config, or fallback cases
- Slug rules:
- Keep it lowercase and hyphenated
- Prefer 3-5 words when possible
- Use the session goal first, with changed files as supporting evidence
- Avoid vague slugs like
updatesormisc-fixes
- Examples:
feat/add-git-branch-skillfix/handle-default-branch-detectdocs/update-skill-readme
If the intent is still unclear after reviewing the session and git changes, ask the user for the branch name instead of guessing.
If the generated local branch name already exists, append a short numeric suffix until it is unique:
git show-ref --verify --quiet "refs/heads/<branch-name>"Branch Creation Workflow
- Detect the current branch and the default branch.
- Generate a descriptive branch name from the session context and current git changes.
- If already on the detected default branch, create the new branch directly from the current state:
This preserves staged and unstaged changes on the new branch.git switch -c <branch-name> # Fallback for older Git versions: git checkout -b <branch-name> - If on a different branch and the worktree is clean, return to the default branch first, then create the new branch:
git switch <default-branch> # Fallback for older Git versions: git checkout <default-branch> git switch -c <branch-name> # Fallback for older Git versions: git checkout -b <branch-name> - If on a different branch and the worktree is dirty:
- Do not stash, reset, or discard changes automatically
- Ask the user whether to branch from the current state or first return to
<default-branch>
- After creating the branch, confirm the result:
git branch --show-current git status --short
Error Handling
- Could not detect default branch → "Error: Could not determine the default branch from
origin/HEADor localmain/master/develop." - Branch intent still unclear → ask the user for the desired branch name
- Dirty worktree on a non-default branch → ask before switching branches
- Branch switch/create command fails due to uncommitted changes, conflicts, or unsupported git subcommands → surface the git error and stop
- Generated branch name already exists locally → add a numeric suffix like
-2or-3 - Never use destructive commands like
git reset --hardand never discard the user's changes automatically
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.

