Skip to content

claude-commands/command-sync-fork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

command-sync-fork

A Claude Code slash command for syncing forked repositories with upstream changes.

Installation

# Clone to your preferred location
git clone git@github.com:claude-commands/command-sync-fork.git <clone-path>/command-sync-fork

# Symlink (use full path to cloned repo)
ln -s <clone-path>/command-sync-fork/sync-fork.md ~/.claude/commands/sync-fork.md

Usage

/sync-fork                  # Sync default branch with upstream
/sync-fork --rebase         # Rebase local changes on upstream
/sync-fork --all            # Sync all tracking branches
/sync-fork --dry-run        # Show what would be synced
/sync-fork develop          # Sync specific branch

What it does

  1. Detects upstream remote (adds if missing)
  2. Fetches upstream changes
  3. Analyzes divergence between fork and upstream
  4. Merges or rebases onto local branch
  5. Pushes updated branch to origin

Output Format

Fork Sync Complete

Branch: main
Strategy: Merge
Commits Added: 15

Changes from Upstream:
| Category | Files | Lines       |
| -------- | ----- | ----------- |
| Added    | 3     | +450        |
| Modified | 12    | +234 / -156 |

Pushed to: origin/main

Sync Strategies

Strategy Use Case
Merge Preserve commit history (default)
Rebase Linear history, rewrites commits
Reset Match upstream exactly (destructive)

Options

Option Description
--rebase Rebase instead of merge
--merge Merge upstream (default)
--all Sync all tracking branches
--dry-run Preview without changes
--force Force push after sync

Requirements

  • Git
  • GitHub CLI (gh) for fork detection
  • Claude Code with Opus 4.5 model access

Updates

cd <clone-path>/command-sync-fork && git pull

About

Sync forked repository with upstream changes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published