diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-01-16 16:46:16 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-16 16:26:27 -0800 |
commit | 2857093ba15982d21ff0d5a9fd65294ac895cb67 (patch) | |
tree | 64b1314c469f9192be5aee4b966d7e0265b8a8f5 /builtin/checkout.c | |
parent | 5a7d5b683f869d3e3884a89775241afa515da9e7 (diff) | |
download | git-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.gz |
clone: print advice on checking out detached HEAD
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r-- | builtin/checkout.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index f1984d9933..5bf96ba4d4 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -514,20 +514,6 @@ static void report_tracking(struct branch_info *new) strbuf_release(&sb); } -static void detach_advice(const char *old_path, const char *new_name) -{ - const char fmt[] = - "Note: checking out '%s'.\n\n" - "You are in 'detached HEAD' state. You can look around, make experimental\n" - "changes and commit them, and you can discard any commits you make in this\n" - "state without impacting any branches by performing another checkout.\n\n" - "If you want to create a new branch to retain commits you create, you may\n" - "do so (now or later) by using -b with the checkout command again. Example:\n\n" - " git checkout -b new_branch_name\n\n"; - - fprintf(stderr, fmt, new_name); -} - static void update_refs_for_switch(struct checkout_opts *opts, struct branch_info *old, struct branch_info *new) @@ -575,7 +561,7 @@ static void update_refs_for_switch(struct checkout_opts *opts, REF_NODEREF, DIE_ON_ERR); if (!opts->quiet) { if (old->path && advice_detached_head) - detach_advice(old->path, new->name); + detach_advice(new->name); describe_detached_head(_("HEAD is now at"), new->commit); } } else if (new->path) { /* Switch branches. */ |