Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

multi-repo-git-ops

БесплатноБез исполняемых скриптовНе проверен

Manages git operations (branching, committing, pushing, syncing) in multi-repo systems — a parent repo with git submodules or multiple service repos. Use this…

bmad-labsот bmad-labs★ 20 звёзд на GitHub

Об этом скилле

Multi-Repo Git Operations

This skill handles git operations in multi-repo systems that use git submodules. The parent repo orchestrates multiple service repos, each an independent git repository with its own branches, history, and CI/CD.

Understanding this structure is essential — git operations here always involve deciding which repos are affected and operating in each one correctly.

Discovery Protocol

Before performing any git operations, discover the project structure dynamically. Never assume service names, branch mappings, or directory layout — always read from .gitmodules.

Step 1: Identify submodules and their paths

# List all submodules with their paths
git config -f .gitmodules --get-regexp '\.path$'

Step 2: Identify each submodule's tracked branch

# List all submodule branch mappings (keyed by submodule *name*)
git config -f .gitmodules --get-regexp '\.branch$'

.gitmodules sections are keyed by submodule name, which may differ from its path ([submodule "auth"] with path = services/auth-service). To look up a submodule's branch from its path, resolve the name first. Define this helper once per shell session and use it everywhere below:

# usage: sub_branch <submodule-path>  → prints that submodule's default branch
sub_branch() {
  local name
  name=$(git config -f .gitmodules --get-regexp '^submodule\..*\.path$' \
    | awk -v p="$1" '$2==p {n=$1; sub(/^submodule\./,"",n); sub(/\.path$/,"",n); print n}')
  # Fall back to the submodule remote's HEAD when .gitmodules has no branch
  git config -f .gitmodules "submodule.$name.branch" \
    || git -C "$1" symbolic-ref --short refs/remotes/origin/HEAD | sed 's|^origin/||'
}

If the fallback fails because origin/HEAD is not set locally, run git -C {submodule-path} remote set-head origin --auto or read it with git -C {submodule-path} remote show origin | grep 'HEAD branch'.

Also record the parent repo's default branch — never assume main:

PARENT_DEFAULT=$(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's|^origin/||')

Step 3: Detect project methodology

  • BMAD: Check if _bmad-output/implementation-artifacts/ directory exists
  • If BMAD is detected, the BMAD Integration section applies

Step 4: Cache discovered info for the session

After discovery, the agent knows:

  • All submodule names and paths
  • Each submodule's default branch
  • The parent repo's default branch
  • Whether BMAD is in use
  • The submodule directory prefix (commonly services/)

Use this cached information for all subsequent operations in the session.

Repository Structure

A typical multi-repo project looks like this:

{parent-repo}/                       (parent repo — planning & orchestration only)
├── .gitmodules                      (submodule definitions with tracked branches)
├── services/                        (submodule repos — directory name may vary)
│   ├── auth-service/                (branch: develop)
│   ├── booking-service/             (branch: dev)
│   ├── config-repo/                 (branch: main)
│   └── ...
└── [project methodology dirs]       (e.g., _bmad-output/ if using BMAD)

Key principle: The parent repo tracks commit pointers to each submodule, not the submodule code itself. When you change code in a service, you commit in the service repo, then update the parent's pointer.

Branch Conventions

Default Branches by Service

Services may track different default branches — always look up the correct one before branching:

# Get a service's default branch (always use this — never assume; see sub_branch in Discovery Step 2)
sub_branch {submodule-path}

Different services in the same project often use different default branches (e.g., develop, dev, main). The only reliable source of truth is .gitmodules.

Feature Branch Naming

For ticket-based work (JIRA/project tracker):

{type}/{TICKET-ID}-{short-description}

Examples: feat/PROJ-1234-add-search-by-date, bugfix/PROJ-5678-fix-null-pointer

For BMAD story work (derived from story file name):

feat/{story-key}

The story key comes from the story file name. A story file named 1-2-user-authentication.md (representing Epic 1, Story 2) produces branch name feat/1-2-user-authentication.

Branch type prefixes: feat/, fix/, bugfix/, chore/, base/

BMAD Integration (If Applicable)

This section applies only if the project uses the BMAD methodology. Detect this by checking for the _bmad-output/implementation-artifacts/ directory.

BMAD manages work through story files and sprint status tracking. This section explains how git operations map to the BMAD lifecycle.

How Stories Reference Services

BMAD story files live at _bmad-output/implementation-artifacts/{story-key}.md. Stories reference affected services in several ways — check all of these:

  1. Service tags in story title or body: `[auth-service
Полный SKILL.md на GitHub

Установить multi-repo-git-ops в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл multi-repo-git-ops?

Manages git operations (branching, committing, pushing, syncing) in multi-repo systems — a parent repo with git submodules or multiple service repos. Use this skill when, in such a project, the user wants to create a feature branch, commit or push changes, sync submodules, update submodule pointers, or manage branches across the parent repo and its service repos. Also use when implementing BMAD stories that touch one or more services of a submodule-based project, or when the user asks about git workflow in a multi-repo project. Triggers on phrases like "create branch across services", "commit changes in the services", "sync submodules", "update submodule pointers", "start working on story", "update service branch", or any git operation that spans parent and submodule repos. Not for ordinary git work in a single repo without submodules.

Как установить скилл multi-repo-git-ops?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл multi-repo-git-ops запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить multi-repo-git-ops с