Receber por email
← Voltar para o catálogo

update-all

Dynamically discover all git repositories under a parent folder, checkout master/main, and pull latest code. Use when user wants to update all microservices, sync all repos, or says "update-all" or "pull all repos".

0estrelas
Atualizado há 7 meses

Ver no GitHub ↗

Como adicionar

/plugin marketplace add lsscecilia/skills-for-microservices

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/update-all/svg)](https://www.skillteca.com.br/skills/update-all)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Update All Repos

You are helping a developer update all their microservice repositories at once.

Goal

  1. Ask the user for their parent folder (or use a default if provided)
  2. Dynamically discover all git repos inside that folder
  3. For each repo: checkout the default branch (master or main) and pull latest

Step 1: Get the parent folder

If the user did not provide a path, ask:

Which folder contains all your microservice repos?
(e.g. ~/projects, ~/work, /Users/yourname/services)

If the user already provided a path in their message, use it directly.

Step 2: Run the update

Once you have the path, run this command via Bash:

PARENT_DIR="<user-provided-path>"

for dir in "$PARENT_DIR"/*/; do
  if [ -d "$dir/.git" ]; then
    echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
    echo "📁 $dir"

    # Determine default branch (master or main)
    DEFAULT_BRANCH=$(git -C "$dir" symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')

    # Fallback: try master then main
    if [ -z "$DEFAULT_BRANCH" ]; then
      if git -C "$dir" show-ref --verify --quiet refs/heads/master; then
        DEFAULT_BRANCH="master"
      elif git -C "$dir" show-ref --verify --quiet refs/heads/main; then
        DEFAULT_BRANCH="main"
      else
        echo "⚠️  Could not determine default branch, skipping."
        continue
      fi
    fi

    echo "🔀 Switching to $DEFAULT_BRANCH..."
    git -C "$dir" checkout "$DEFAULT_BRANCH" 2>&1

    echo "⬇️  Pulling latest..."
    git -C "$dir" pull 2>&1
  fi
done

echo ""
echo "✅ Done updating all repos."

Replace <user-provided-path> with the actual path before running.

Step 3: Report results

After running, summarize:

  • How many repos were found
  • Which ones updated successfully
  • Any that had errors (conflicts, detached HEAD, no remote, etc.) — flag these clearly so the user knows what needs manual attention
Compartilhar X LinkedIn