summaryrefslogtreecommitdiff
path: root/advice.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-16 09:46:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-17 00:26:27 (GMT)
commit2857093ba15982d21ff0d5a9fd65294ac895cb67 (patch)
tree64b1314c469f9192be5aee4b966d7e0265b8a8f5 /advice.c
parent5a7d5b683f869d3e3884a89775241afa515da9e7 (diff)
downloadgit-2857093ba15982d21ff0d5a9fd65294ac895cb67.zip
git-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.gz
git-2857093ba15982d21ff0d5a9fd65294ac895cb67.tar.bz2
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 'advice.c')
-rw-r--r--advice.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/advice.c b/advice.c
index e02e632..3e1a145 100644
--- a/advice.c
+++ b/advice.c
@@ -64,3 +64,17 @@ void NORETURN die_resolve_conflict(const char *me)
error_resolve_conflict(me);
die("Exiting because of an unresolved conflict.");
}
+
+void detach_advice(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);
+}