git-branch
Skill50 starsChanged 16 days agoMITView on GitHub
Branch management for implementation. Use when you need to create a branch, switch branches, checkout, or verify branching strategy before implementing code. Do not use for commits (use git-commit), pull requests (use pull-request), or advanced git operations (rebase, merge).
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 4 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
- Very specific: line 14
If Branching Strategy is filled in, use the configured strategy.
- Very specific: line 16
If the config has Confidence: medium, confirm with the dev before using (see Detect Branching Strategy section).
- Very specific: line 30
If on main/master/develop, check synchronization:
- Distinctive: line 42
If the main branch is behind:
- Distinctive: line 65
When the source of work is a GitHub issue or Azure DevOps work item, create the branch automatically.
- Distinctive: line 78
Remove articles, prepositions, and unnecessary words
- Distinctive: line 88
Action: Create branch and inform the user:
- Distinctive: line 101
When the source is tasks.md (without issue/work item), ask the user:
- Distinctive: line 115
If the user is already on a feature branch, use the current branch without additional questions.
- Very specific: line 119
When .memory/git-config.md does not exist or does not have Branching Strategy, detect 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
Git Branch — Branch Management
Check Branching Strategy Config
cat .memory/git-config.md 2>/dev/nullIf Branching Strategy is filled in, use the configured strategy. The detect-branching-strategy.sh hook automatically seeds on sessionStart.
If the config has Confidence: medium, confirm with the dev before using (see Detect Branching Strategy section).
Check Git State
Before starting implementation:
git branch --show-current
git status
git fetch originRemote Synchronization
If on main/master/develop, check synchronization:
git rev-list HEAD..origin/<branch> --count| Situation | Action |
| Branch behind (commits behind remote) | Alert and suggest pull |
| Branch with uncommitted local changes | Alert about pending changes |
| Branch up to date and clean | Proceed normally |
If the main branch is behind:
Your branch [main] is [N] commits behind the remote.
I recommend updating before creating a new branch:
[P] Pull and continue
[I] Ignore and continue anyway (not recommended)
[A] Abort implementationEvaluate Situation for Branch Creation
| Situation | Action |
| Already on a feature branch (not main/master/develop) | Use current branch |
| On main/master/develop without changes with work item | Create branch automatically (see below) |
| On main/master/develop without changes without work item | Ask if they want to create a branch |
| On main/master/develop with changes | Alert and ask how to proceed |
Automatic Creation (when there is a work item)
When the source of work is a GitHub issue or Azure DevOps work item, create the branch automatically.
Naming convention:
feature/<id>-<short-description>Rules for <short-description>:
- Derived from the work item title
- Lowercase letters, numbers, and hyphens only
- Maximum 50 characters in the total branch name
- Remove articles, prepositions, and unnecessary words
Examples:
| Work Item | Branch |
| #42 "Implement user authentication" | feature/42-user-authentication |
| #108 "Add rate limiting to API endpoints" | feature/108-rate-limiting-api |
| WI 5678 "Create financial reports endpoint" | feature/5678-financial-reports-endpoint |
Action: Create branch and inform the user:
Branch created: feature/<id>-<short-description>
[C] Continue with this branch
[R] Rename branch: _The user can rename, but the flow does not block waiting for confirmation to create.
Interactive Creation (without work item)
When the source is tasks.md (without issue/work item), ask the user:
You are on the main branch. Do you want me to create a branch for this implementation?
Suggestion: feature/<short-description>
[S] Yes, create suggested branch
[N] No, continue on current branch
[C] Create with another name: _Existing Branch
If the user is already on a feature branch, use the current branch without additional questions.
Detect Branching Strategy
When .memory/git-config.md does not exist or does not have Branching Strategy, detect automatically:
# 1. Default branch
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
# 2. Does develop branch exist?
HAS_DEVELOP=$(git ls-remote --heads origin develop 2>/dev/null | grep -q develop && echo "yes" || echo "no")
# 3. Do release/* or hotfix/* branches exist? (GitFlow pattern)
HAS_GITFLOW_BRANCHES=$(git branch -r 2>/dev/null | grep -qE '(release|hotfix)/' && echo "yes" || echo "no")Detection rules
develop | release/* or hotfix/* | Strategy | Confidence | Action |
| Yes | Yes | GitFlow | High | Save and inform |
| Yes | No | GitFlow | Medium | Ask to confirm |
| No | No | Trunk-Based | High | Save and inform |
High confidence — save automatically and inform:
Branching strategy detected: [trunk-based|gitflow]
Integration branch: [branch]
Saved to .memory/git-config.md. To change: edit the file or delete it.Medium confidence — ask to confirm:
I detected a `develop` branch in the repository.
Which branching strategy does the project use?
[G] GitFlow (features → develop)
[T] Trunk-Based (features → main/master)Save config
Save to .memory/git-config.md:
# Git Config
Branching Strategy: [trunk-based|gitflow]
Integration Branch: [main|master|develop]Behavior by Strategy
| Action | Trunk-Based | GitFlow |
| Branch created from | Integration Branch | Integration Branch (develop) |
| PR target | Integration Branch | Integration Branch (develop) |
next-task returns to | Integration Branch | Integration Branch (develop) |
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- my-chiefmind/ai-maestro★ 6same name
- mir-am/skills-agents-ai-coding★ 2same 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 repository26 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .github/plugins/devsquad/hooks/templates/.github/copilot-instructions.mdCopilot instructions
- adr-workflowSkill
- board-configSkill
- complexity-analysisSkill
- debugging-recoverySkill
- deep-clarificationSkill
- diagram-designSkill
- documentation-styleSkill
- domain-glossarySkill
- engineering-practicesSkill
- git-commitSkill
- harness-learningsSkill
- init-configSkill
- init-docsSkill
- init-scaffoldSkill
- lsp-setupSkill
- next-taskSkill
- pull-requestSkill
- quality-gateSkill
- reasoningSkill
- security-reviewSkill
- test-disciplineSkill
- triage-workflowSkill
- work-item-creationSkill
- work-item-workflowSkill
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.

