diff options
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r-- | builtin/rebase.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index ffa467aad5..7bff0c87bc 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -2044,10 +2044,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) /* Is it a local branch? */ strbuf_reset(&buf); strbuf_addf(&buf, "refs/heads/%s", branch_name); - if (!read_ref(buf.buf, &options.orig_head)) + if (!read_ref(buf.buf, &options.orig_head)) { + die_if_checked_out(buf.buf, 1); options.head_name = xstrdup(buf.buf); /* If not is it a valid ref (branch or commit)? */ - else if (!get_oid(branch_name, &options.orig_head)) + } else if (!get_oid(branch_name, &options.orig_head)) options.head_name = NULL; else die(_("fatal: no such branch/commit '%s'"), |