Skip to content

Commit 8d61b96

Browse files
committed
Fix up error message
1 parent 8b5abc7 commit 8d61b96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/cmd/repo/sync/sync.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func syncLocalRepo(srcRepo ghrepo.Interface, opts *SyncOptions) error {
216216
}
217217

218218
if !fastForward && !opts.Force {
219-
return fmt.Errorf("can't sync .:%s because there are diverging commits, try using `--force`", branch)
219+
return fmt.Errorf("can't sync because there are diverging commits, you can use `--force` to overwrite the commits on .:%s", branch)
220220
}
221221
}
222222

@@ -282,9 +282,9 @@ func syncRemoteRepo(client *api.Client, destRepo, srcRepo ghrepo.Interface, opts
282282
err = syncFork(client, destRepo, opts.Branch, commit.Object.SHA, opts.Force)
283283
var httpErr api.HTTPError
284284
if err != nil && errors.As(err, &httpErr) && notFastForwardErrorMessage.MatchString(httpErr.Message) {
285-
return fmt.Errorf("can't sync %s:%s because there are diverging commits, try using `--force`",
286-
ghrepo.FullName(destRepo),
287-
opts.Branch)
285+
destStr := fmt.Sprintf("%s:%s", ghrepo.FullName(destRepo), opts.Branch)
286+
return fmt.Errorf("can't sync because there are diverging commits, you can use `--force` to overwrite the commits on %s",
287+
destStr)
288288
}
289289

290290
return err

0 commit comments

Comments
 (0)