Skip to main content

Save Changes Across Repositories

Save and push changes across all repositories in your workspace.

Overview

The save command simplifies git operations across multiple repositories:

  • Detects repositories - Finds all repos (umbrella childRepos or current repo)
  • Checks for changes - Identifies repos with uncommitted changes
  • Sets up remotes - Prompts for remote URL if missing
  • Commits changes - Stages all changes with user-provided message
  • Pushes to remote - Pushes commits to origin

Usage

"Save progress"

Additional options:

# Interactive (prompts for commit message)
sw:save

# Dry run (show what would happen, don't execute)
sw:save --dry-run

# Save specific repos only (umbrella mode)
sw:save "fix: Bug fixes" --repos frontend,backend

# Skip repos without remote (don't prompt)
sw:save "chore: Updates" --skip-no-remote

Workflow Example

Multi-Repo (Umbrella Mode)

sw:save "feat: Complete user registration flow"

Scanning for repositories...
Mode: Umbrella (3 child repos)

Checking git status...

sw:
Status: 4 files changed
Remote: origin -> github.com/user/frontend

backend:
Status: 2 files changed
Remote: origin -> github.com/user/backend

shared:
Status: No changes (skipping)

Saving changes...

sw:
git add -A
git commit -m "feat: Complete user registration flow"
git push origin main

backend:
git add -A
git commit -m "feat: Complete user registration flow"
git push origin main

Summary:
Saved: 2/3 repositories
Skipped: 1 (no changes)

Workspace Mode (Single Repository)

sw:save "chore: Update dependencies"

Scanning for repositories...
Mode: Workspace (1 repository)
Repository: my-project (.)

my-project:
Status: 2 files changed
- package.json (modified)
- package-lock.json (modified)
Remote: origin -> github.com/user/my-project

Saving changes...

my-project:
git add -A
git commit -m "chore: Update dependencies"
git push origin main

Summary:
Saved: 1/1 repository

Remote Setup

When a repository has no remote configured, you'll be prompted:

sw:
No remote configured.

Options:
1. Enter remote URL manually
2. Use GitHub convention (github.com/[org]/frontend)
3. Use URL from umbrella config
4. Skip this repo

? Choice: [1/2/3/4]

Using Umbrella Config

If githubUrl is configured in your umbrella config, remotes are set up automatically:

{
"umbrella": {
"enabled": true,
"childRepos": [
{
"id": "myapp-frontend",
"path": "./myapp-frontend",
"prefix": "FE",
"githubUrl": "https://github.com/myorg/myapp-frontend"
}
]
}
}

Note: The id MUST match the repo name (not arbitrary abbreviations like fe).

Options

FlagDescription
--dry-runShow what would happen, don't execute
--repos <list>Only save specific repos (comma-separated)
--skip-no-remoteSkip repos without remotes (don't prompt)
--allInclude repos outside umbrella config
--no-pushCommit but don't push
--forceForce push (use with caution!)

Error Handling

Push Failure (Authentication)

sw:
Pushing failed!

Error: Permission denied (publickey)

Troubleshooting:
1. Check SSH key is added: ssh -T [email protected]
2. Use HTTPS instead: git remote set-url origin https://...
3. Check GitHub token has 'repo' scope

? Continue with other repos? [Yes / No]

Push Failure (Divergent History)

backend:
Pushing failed!

Error: Updates were rejected (remote contains work not in local)

Options:
1. Pull and merge: git pull --rebase origin main
2. Force push (DANGEROUS): git push --force
3. Skip this repo

? Choice: [1/2/3]

Best Practices

  1. Use descriptive commit messages - Same message applies to all repos
  2. Review changes first - Use --dry-run to see what will happen
  3. Configure githubUrl - Set in umbrella config for seamless remote setup
  4. Handle failures - Don't ignore push failures, resolve before continuing
Natural LanguageClaude CodeOther AI ToolsPurpose
"Align versions"sw-release:alignrelease alignAlign versions across repos (for releases)
"Sync progress"sw:sync-progresssync-progressSync task progress to external tools
"Sync to GitHub"sw-github:syncgithub-syncSync increments to GitHub issues

See Also