sync-to-origin

Back up local state, fetch with prune, and reset branches to origin.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/stodesirnit976-bit/Skills --skill sync-to-origin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sync-to-origin
Source: https://github.com/stodesirnit976-bit/Skills/tree/main/custom/sync-to-origin
Command: npx skills add https://github.com/stodesirnit976-bit/Skills --skill sync-to-origin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires git, and includes scripts (resource) components.

What problem does it solve?

This skill automates aligning a local Git workspace with the remote origin by backing up local state, fetching with prune, and resetting branches to origin.

Core Features & Use Cases

  • Backup local state to .git/codex-sync-backups (bundle, diff, and optional untracked backups)
  • Fetch from origin with prune to remove remote-tracking references that no longer exist
  • Reset local branches to origin/<branch>, discarding local divergences
  • Remove local branches that no longer exist on the remote to maintain consistency

Quick Start

Run the synchronization script against a Git repository to align the current workspace with origin: pwsh -NoProfile -ExecutionPolicy Bypass -File custom/sync-to-origin/scripts/sync-to-origin.ps1 -Yes

Frequently Asked Questions about sync-to-origin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I synchronize local git branches with origin and discard local changes?▼

To synchronize local git branches with origin, you can run an automated script that fetches with prune, creates backups under .git/codex-sync-backups, and performs hard resets to origin/*. This discards local divergences and aligns your workspace with the remote.

What is the best way to clean up stale git branches across multiple devices?▼

The best way to clean up stale git branches across devices is using a synchronization workflow that runs git fetch --prune, prunes remote-tracking references, and removes local branches that no longer exist on the remote to maintain repository consistency.

Does syncing local git workspaces to origin create a backup before resetting?▼

Yes, syncing local git workspaces to origin creates deterministic backups under .git/codex-sync-backups before resetting. These backups include git bundles, diffs, and optional untracked file backups to preserve your local state before discarding divergences.

Can I use a PowerShell script to reset all local branches to origin automatically?▼

Yes, you can use a PowerShell script to reset all local branches to origin automatically. By executing the sync-to-origin.ps1 script with the -Yes flag, the tool deterministically resets branches to origin/* and prunes stale remote-tracking references.

When should I avoid hard resetting local branches to origin?▼

You should avoid hard resetting local branches to origin when you have uncommitted work or local commits that are not backed up. While the process creates backups under .git/codex-sync-backups, the hard reset to origin/* will permanently discard any local divergences from the remote state.