Skip to content

feat(sync): add daft sync / git sync command#263

Merged
avihut merged 7 commits intomasterfrom
feat/sync
Feb 23, 2026
Merged

feat(sync): add daft sync / git sync command#263
avihut merged 7 commits intomasterfrom
feat/sync

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Feb 23, 2026

Summary

  • Add daft sync / git worktree-sync command that prunes stale worktrees, pulls updates for all tracked branches, and optionally rebases them onto a base branch (--rebase <BRANCH>)
  • Reuse existing prune and update core logic with structured output showing per-branch status (up-to-date, updated, failed, skipped)
  • Add shell completions, man pages, CLI docs, packaging, integration tests, and shortcut aliases (gwtsync)

Test plan

  • Unit tests pass (mise run test:unit — 384 tests)
  • Integration tests added (tests/integration/test_sync.sh)
  • Clippy clean, fmt clean, man pages and CLI docs verified
  • CI passes on all platforms
  • Manual smoke test: daft sync and daft sync --rebase master

🤖 Generated with Claude Code

avihut and others added 7 commits February 24, 2026 01:11
Adds a new `sync` command that orchestrates `prune` + `update --all` in a
single step. This is the recommended way to synchronize all worktrees with
the remote: it first prunes stale branches/worktrees, then updates all
remaining worktrees from their tracking branches.

Available as `git sync`, `daft sync`, and `gwtsync` shortcut. Supports
`--verbose` and `--force` flags. Handles CD out of pruned worktrees via
DAFT_CD_FILE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…status

Prune phase now shows per-branch detail lines describing what was removed
(worktree, local branch, remote tracking branch) instead of just aggregate
counts. Update phase now distinguishes [updated] from [up to date], shows
captured pull diff output indented under updated branches, and reports
accurate summary counts. These improvements apply to daft sync, daft prune,
and daft update commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ncing

After prune + update, optionally rebase all worktree branches onto a
base branch (e.g., master). Best-effort: conflicts are immediately
aborted and reported, leaving the worktree clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass --color=always to git pull when colors are enabled so diff stats
(insertions/deletions) render with proper ANSI colors in both daft
update and daft sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
git pull doesn't support --color=always as a flag. Pass it as a git-level
config override (-c color.diff=always) before the pull subcommand instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The sync_force and sync_cd_target tests used git-worktree-checkout on
branches that didn't exist on the remote, causing checkout to fail.
Push the branches to the remote before cloning so checkout can find them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut added this to the v1.1.0 milestone Feb 23, 2026
@avihut avihut added the feat New feature label Feb 23, 2026
@avihut avihut self-assigned this Feb 23, 2026
@avihut avihut linked an issue Feb 23, 2026 that may be closed by this pull request
@avihut avihut merged commit 8c6afb3 into master Feb 23, 2026
6 checks passed
@avihut avihut deleted the feat/sync branch February 23, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sync command to fast-forward all tracked branches and worktrees

1 participant