Skip to content

Commit 6d58684

Browse files
committed
run fetch before sync
1 parent 4ac0d4c commit 6d58684

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cmd/sync.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ func runSync(cfg *config.Config, opts *syncOptions) error {
7676
return ErrSilent
7777
}
7878

79-
if err := git.Fetch(remote); err != nil {
80-
cfg.Warningf("Failed to fetch %s: %v", remote, err)
81-
} else {
82-
cfg.Successf("Fetched latest changes from %s", remote)
83-
}
79+
// Fetch trunk + active branches so tracking refs are current for
80+
// fast-forward detection (Step 2) and --force-with-lease (Step 4).
81+
fetchTargets := append([]string{s.Trunk.Branch}, activeBranchNames(s)...)
82+
_ = git.FetchBranches(remote, fetchTargets)
83+
cfg.Successf("Fetched latest changes from %s", remote)
8484

8585
// --- Step 2: Fast-forward trunk ---
8686
trunk := s.Trunk.Branch

0 commit comments

Comments
 (0)