Skip to main content

Module sync

Module sync 

Source
Expand description

gwm sync (issue #24) — fetch + rebase / merge a worktree’s branch onto its configured upstream.

The read-side inspection (dirty check, upstream resolution, ahead/behind) goes through libgit2; the mutating steps (fetch, rebase, merge) shell out to the git binary. That split is deliberate: libgit2’s fetch needs the caller to wire credential callbacks (SSH agents, tokens, helpers) to talk to a real remote, whereas the user’s git already has all of that configured. The existing sidebar previews (git_log_oneline, git_status_short) shell out for the same reason, so this stays consistent.

Structs§

SyncReport
Outcome of a successful sync run. Conflicts, dirty trees, and missing upstreams surface as GwmError instead — only the non-error paths produce a report.

Enums§

SyncAction
What sync actually did once preconditions passed.
SyncStrategy
How gwm sync reconciles the local branch when it is behind its upstream. Defaults to rebase (linear history, the repo convention); --merge opts into a merge commit instead.

Functions§

sync
Fetch start’s upstream, then rebase (or merge) the local branch onto it. start may be any path inside the target worktree — the repository is discovered upwards from it.