<< All versions

Skill v1.0.0

currentTrusted Publisher100/100
microsoft/devsquad-copilot/git-branch
──Details
PublishedOctober 17, 2026 at 04:33 PM
Content Hashsha256:7e562b13abeea154...
Git SHA
──Files
Files (1 file, 5.1 KB)
SKILL.md5.1 KBactive
SKILL.md · 179 lines · 5.1 KB

version: "1.0.0" name: git-branch description: "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)."


Git Branch — Branch Management

Check Branching Strategy Config

bash
cat .memory/git-config.md 2>/dev/null

If 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:

bash
git branch --show-current
git status
git fetch origin

Remote Synchronization

If on main/master/develop, check synchronization:

bash
git rev-list HEAD..origin/<branch> --count
SituationAction
Branch behind (commits behind remote)Alert and suggest pull
Branch with uncommitted local changesAlert about pending changes
Branch up to date and cleanProceed 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 implementation

Evaluate Situation for Branch Creation

SituationAction
Already on a feature branch (not main/master/develop)Use current branch
On main/master/develop without changes with work itemCreate branch automatically (see below)
On main/master/develop without changes without work itemAsk if they want to create a branch
On main/master/develop with changesAlert 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 ItemBranch
#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:

bash
# 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

developrelease/* or hotfix/*StrategyConfidenceAction
YesYesGitFlowHighSave and inform
YesNoGitFlowMediumAsk to confirm
NoNoTrunk-BasedHighSave 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:

markdown
# Git Config
Branching Strategy: [trunk-based|gitflow]
Integration Branch: [main|master|develop]

Behavior by Strategy

ActionTrunk-BasedGitFlow
Branch created fromIntegration BranchIntegration Branch (develop)
PR targetIntegration BranchIntegration Branch (develop)
next-task returns toIntegration BranchIntegration Branch (develop)
All versions