git-sync-workspace

A command that updates multiple Git repositories in a Cursor workspace from their remote default branches. A workspace can contain several related repositories, and a remote is the shared copy hosted elsewhere.

In plain words
What is it for?
Use it to discover repositories, fetch updates, fast-forward clean ones, skip dirty or unsafe ones, and report which were synced, skipped, or failed.
Why use it?
It brings clean repositories up to date while avoiding changes that could overwrite uncommitted work.

Command for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/emaraschio/cursor-commands/git-sync-workspace
Clone the repo
git clone --depth 1 https://github.com/emaraschio/cursor-commands

Made for: Cursor.

Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 555 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.00555
Opus 5 $0.00015 $0.00278
Sonnet 5 $0.00006 $0.00111
Haiku 4.5 $0.00003 $0.00056

Measured 2d ago against content hash 8f7af4b2a045, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-sync-workspace scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/commands/git-sync-workspace.md · 45 lines

What it actually says

Overview

Discover git repos in a Cursor multi-root workspace, preflight each one, and sync clean repos to their remote default branch. Skips dirty or unsafe repos with a clear report. Full workflow: .cursor/skill-contracts/git-sync-workspace/SKILL.md (user install: ~/.cursor/skill-contracts/git-sync-workspace/SKILL.md).

Defaults

Setting Default
Dirty repos Skip and report (no writes)
Pull strategy --ff-only
Fetch --all --prune
Concurrency ≤ 6 parallel fetches

Steps

  1. Read .cursor/skill-contracts/git-sync-workspace/SKILL.md for the full agent contract; if that file is missing, read ~/.cursor/skill-contracts/git-sync-workspace/SKILL.md.
  2. Execute phases in order (Discover → Preflight → Sync → Report); do not skip preflight or modify dirty repos.
  3. Report the workspace summary (Synced / Skipped / Failed).

Anti-patterns

  • Never sync over a dirty working tree. Trigger: a repo has uncommitted changes. Wrong: checking out or pulling over the dirty tree, or running git reset --hard to force it. Correct: skip the repo, record skipped_dirty, and continue the others. Reason: overwriting a dirty tree can destroy uncommitted work that is not recoverable.
  • Do not force-push default branches. Reason: force-pushing a shared default branch can erase teammates' commits and rewrite published history.
  • Do not guess repo paths. Trigger: workspace discovery yields nothing. Wrong: scanning arbitrary directories like ~/code/* without direction. Correct: ask the user which paths to include. Reason: syncing repos the user did not intend can disrupt unrelated work.

Examples

  • /git-sync-workspace
  • /git-sync-workspace with "only sync repo1 and repo2"

Maintainers

Behavioral eval: .cursor/skill-contracts/git-sync-workspace/eval/cases.md. Ship gate sections: A, S before changing SKILL.md or this command.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 45 lines · 30 tokens per session scan A 8f7af4b2a045

Subscribe to this mod's changes

git-sync-workspace is a command published in the GitHub repository emaraschio/cursor-commands (9 stars, last pushed 26d ago), licensed MIT. It adds 30 tokens to every session and 555 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.