sync-main

sync-main is a command for Claude Code from eddiebelaval/squire. It costs 0 tokens per session (647 once invoked), scanned A, original, MIT.

A Git workflow for updating a feature branch with the latest changes from the main branch.

In plain words
What is it for?
Use it to inspect branch differences, fetch the main branch, rebase your work, and handle any merge conflicts.
Why use it?
It reduces the chance of working against an outdated codebase and helps identify conflicts before the branch is merged.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Good fit Use it to inspect branch differences, fetch the main branch, rebase your work, and handle any merge conflicts.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/eddiebelaval/squire/sync-main
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.

Clone the repo
git clone --depth 1 https://github.com/eddiebelaval/squire

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sync-main

README.md
[![agentmods](https://agentmods.dev/badge/commands/eddiebelaval/squire/sync-main/github.svg)](https://agentmods.dev/commands/eddiebelaval/squire/sync-main)
Your own site
<a href="https://agentmods.dev/commands/eddiebelaval/squire/sync-main"><img src="https://agentmods.dev/badge/commands/eddiebelaval/squire/sync-main/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sync-main

Your own site · 80×15
<a href="https://agentmods.dev/commands/eddiebelaval/squire/sync-main"><img src="https://agentmods.dev/badge/commands/eddiebelaval/squire/sync-main.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 647 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.00647
Opus 5 $0.00000 $0.00324
Sonnet 5 $0.00000 $0.00129
Haiku 4.5 $0.00000 $0.00065

Measured 5d ago against content hash f0c365150c1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

sync-main 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 5d 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.

commands/sync-main.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sync with Main Branch

You are executing the sync-main workflow - keeps your feature branch up to date with main.

Pre-computed Context

CURRENT_BRANCH=$(git branch --show-current)
MAIN_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main")
LOCAL_CHANGES=$(git status --porcelain)
COMMITS_BEHIND=$(git rev-list --count HEAD..origin/$MAIN_BRANCH 2>/dev/null || echo "unknown")
COMMITS_AHEAD=$(git rev-list --count origin/$MAIN_BRANCH..HEAD 2>/dev/null || echo "unknown")

Current Branch: $CURRENT_BRANCH Main Branch: $MAIN_BRANCH Uncommitted Changes: $LOCAL_CHANGES Commits Behind Main: $COMMITS_BEHIND Commits Ahead of Main: $COMMITS_AHEAD

User Intent

$ARGUMENTS

Workflow

Step 1: Stash if Needed

If LOCAL_CHANGES is not empty:

git stash push -m "sync-main: auto-stash before rebase"

Step 2: Fetch Latest

git fetch origin $MAIN_BRANCH

Step 3: Rebase onto Main

git rebase origin/$MAIN_BRANCH

Step 4: Handle Conflicts

If rebase fails with conflicts:

  1. List conflicting files: git diff --name-only --diff-filter=U
  2. For each file, show the conflict markers
  3. Ask user how to resolve OR attempt auto-resolution if obvious
  4. After resolving: git add <file> then git rebase --continue

If user wants to abort: git rebase --abort

Step 5: Pop Stash

If we stashed earlier:

git stash pop

Handle stash conflicts if they occur.

Step 6: Force Push (if needed)

After rebase, history has changed. Need force push:

git push --force-with-lease origin $CURRENT_BRANCH

Use --force-with-lease NOT --force for safety.

Step 7: Report

Sync complete:
- Rebased $CURRENT_BRANCH onto $MAIN_BRANCH
- Now up to date (was $COMMITS_BEHIND commits behind)
- Pushed to remote

Safety Checks

  • NEVER run on main/master branch directly
  • ALWAYS use --force-with-lease instead of --force
  • ALWAYS stash uncommitted work first
  • If conflicts are complex, ask user before auto-resolving

Read the full file on GitHub · 99 lines

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. 5d ago First seen · 99 lines · 0 tokens per session scan A f0c365150c1e

Subscribe to this mod's changes

sync-main is a command published in the GitHub repository eddiebelaval/squire (21 stars, last pushed 24d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 647 tokens. 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-09-03.