Skip to content
Back to skills

Sync Local Repos

ASecurity

Pull the default branch of every repo in your workspace from origin, then rebase the current branch onto it. Pass `this` to sync only the current repo.

  • 144 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 28, 2026
ai-agentspythonbashgit

Works with

  • claude code

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 28, 2026

npx -y skills add vinta/hal-9000 --skill sync-local-repos --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sync Local Repos?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sync Local Repos
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vinta-sync-local-repos/badge)](https://www.skillsdirectory.com/skills/vinta-sync-local-repos)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sync-local-repos
description: Pull the default branch of every repo in your workspace from origin, then rebase the current branch onto it. Pass `this` to sync only the current repo.
argument-hint: "[all | this]"
disable-model-invocation: true
allowed-tools:
  - Bash(python3 ${CLAUDE_SKILL_DIR}/scripts/sync_local_repos.py *)
---

# sync-local-repos

Use `AskUserQuestion` in Claude Code or `request_user_input` in Codex when available to ask the user anything below.

1. Pick the folder to sync from the session's working directory. The repo's main checkout is `git rev-parse --path-format=absolute --git-common-dir` without the trailing `/.git`.
   - `this`: the main checkout, so only that repo is synced.
   - `all` or no argument, working directory not inside a git repo: the working directory, whose repos sit directly inside it.
   - `all` or no argument, working directory inside a repo: the folder holding the main checkout and its sibling repos, normally the main checkout's parent. When that folder holds no other repo, the repo is probably linked into the real folder by a symlink: find it with `find ~ -maxdepth 3 -lname <main checkout> 2>/dev/null` and use the symlink's folder. When neither gives a folder of sibling repos, ask the user which folder to sync.

2. Run `scripts/sync_local_repos.py` from this skill's folder with that folder and the working directory:

   ```bash
   python3 ${CLAUDE_SKILL_DIR}/scripts/sync_local_repos.py "<folder>" "<working directory>"
   ```

   It fast-forwards each main checkout's default branch (`pull --ff-only` when checked out, `fetch origin <def>:<def>` otherwise), then rebases the branch at the working directory onto `origin/<def>`. Done when it exits: 0 means every step succeeded, 1 means a `FAIL` repo line or a `STOP` line.

3. Settle each `FAIL` and `STOP` line:
   - `FAIL` on a repo: report the git error; a checkout whose default branch diverged from origin needs the user's call.
   - `STOP <upstream> has N commits <branch> lacks`: someone pushed work to the branch that this checkout does not have. Report the listed commits and ask the user before pulling them in. A remote that only holds the same commits rebased, or an older copy of them, does not stop the script: it adopts or rebases past them on its own.
   - `STOP uncommitted changes`, `STOP merge commits`, `STOP conflict`: report the files or commits listed and ask the user how to proceed. A conflict was already aborted, so the branch is unchanged.

4. A rebased branch that was already pushed needs a force-push. Ask the user first, then push with a lease on the tip the remote holds, so a teammate's newer push makes it fail:

   ```bash
   git push --force-with-lease=<branch>:<old tip> origin <branch>
   ```

5. When nothing needs the user, report one line: `Synced <folder>: all N repos ok on their default branch`, plus `; rebased <branch> onto origin/<def>` when the branch moved. Otherwise lead with what needs the user (each `FAIL` and `STOP`, a tree check asking for review, a pending force-push), then the repos that moved, the branch's old and new tip, and whether anything was pushed. Never list checks that passed.

Files in this skill

  • SKILL.md3.1 KB
  • agents/openai.yaml198 B
  • scripts/sync_local_repos.py5.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.