diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/worktree.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c index 96a2834a18..e3199a22e5 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -340,6 +340,9 @@ static int add(int ac, const char **av, const char *prefix) path = prefix ? prefix_filename(prefix, strlen(prefix), av[0]) : av[0]; branch = ac < 2 ? "HEAD" : av[1]; + if (!strcmp(branch, "-")) + branch = "@{-1}"; + opts.force_new_branch = !!new_branch_force; if (opts.force_new_branch) { struct strbuf symref = STRBUF_INIT; |