diff --git a/reset.c b/reset.c index ed9df6ca5c..7ff72de5d2 100644 --- a/reset.c +++ b/reset.c @@ -121,7 +121,10 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts) goto leave_reset_head; } - if (!repo_get_oid(r, "HEAD", &head_oid)) { + if (opts->oid_from) { + oidcpy(&head_oid, opts->oid_from); + head = &head_oid; + } else if (!repo_get_oid(r, "HEAD", &head_oid)) { head = &head_oid; } else if (!oid || !reset_hard) { ret = error(_("could not determine HEAD revision")); diff --git a/reset.h b/reset.h index cb0700ffa7..51ce114543 100644 --- a/reset.h +++ b/reset.h @@ -37,6 +37,11 @@ struct reset_head_opts { * The commit to checkout/reset to. Defaults to HEAD. */ const struct object_id *oid; + /* + * The commit to checkout/reset from when doing a two-way merge. This + * is used as one of the sides to merge. + */ + const struct object_id *oid_from; /* * Optional value to set ORIG_HEAD. Defaults to HEAD. */