sync¶
Pull all repositories in configured workspaces.
When a workspace has git servers attached, sync also fetches the full repository
list from each server, clones any repos that are missing on disk, and can optionally
remove repos that exist locally but are no longer present on any server.
Usage¶
| Option | Description |
|---|---|
--path <dir> | Scan a specific directory instead of configured workspaces |
--clean | Prompt to remove local repos not found on any configured server |
What it does¶
Without server configuration¶
- Discovers all git repositories in each workspace (up to
sync.recurse_depth). - For each repo: optionally stashes uncommitted changes, runs
git fetch(with
--pruneiffetch_prune = true), then fast-forward merges the current branch.
With server configuration¶
- Connects to each configured server and retrieves its repository list.
- Clones any repo that is listed on the server but not yet on disk.
- Warns (or with
--clean, removes) repos on disk that no longer appear on
any configured server. - Pulls all remaining repos as in the no-server case.
Examples¶
# Pull every workspace
git-wrench sync
# Pull a one-off directory (no workspace config needed)
git-wrench sync --path ~/tmp/repos
# Clone missing repos and clean up stale ones
git-wrench sync --clean
Configuration¶
[sync]
recurse_depth = 2 # how deep to scan for .git directories
fetch_prune = true # pass --prune to git fetch
stash_before_pull = false # stash uncommitted changes before pulling
recurse_depth— controls how many directory levels below each workspace root
git-wrench searches for.gitdirectories. Set higher if you nest repos deeper.fetch_prune— removes stale remote-tracking references during fetch.stash_before_pull— whentrue, runsgit stashbefore pulling and
git stash popafterwards so dirty working trees do not block the merge.
Notes¶
- Only fast-forward merges are performed. If a branch has diverged and cannot be
fast-forwarded, the repo is marked as an error and left unchanged. - Repos that were just cloned are skipped in the pull phase (they are already up to date).
- A depth warning is printed when a remote repo path is deeper than
recurse_depth
— the repo will be cloned but then not found during the pull scan.
See also¶
status— view the current state of all repos without pullingworkspace add-server— attach a git server for auto-cloneworkspace add-token— store an API token for server access