summaryrefslogtreecommitdiff
path: root/advice.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-01 06:24:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-01 06:24:23 (GMT)
commit5ce2b97d2c2890e4ee1dd3bc936ea20d71f830ae (patch)
tree369fb774d445e9bdbe25f8042fa2880eb3bece1a /advice.c
parent5e92376f8f70603e570f821267fc86c78175eb09 (diff)
parent9049816140e75d3f7b15264e97e042f5ab0bf392 (diff)
downloadgit-5ce2b97d2c2890e4ee1dd3bc936ea20d71f830ae.zip
git-5ce2b97d2c2890e4ee1dd3bc936ea20d71f830ae.tar.gz
git-5ce2b97d2c2890e4ee1dd3bc936ea20d71f830ae.tar.bz2
Merge branch 'nd/clone-detached'
* nd/clone-detached: clone: fix up delay cloning conditions push: do not let configured foreign-vcs permanently clobbered clone: print advice on checking out detached HEAD clone: allow --branch to take a tag clone: refuse to clone if --branch points to bogus ref clone: --branch=<branch> always means refs/heads/<branch> clone: delay cloning until after remote HEAD checking clone: factor out remote ref writing clone: factor out HEAD update code clone: factor out checkout code clone: write detached HEAD in bare repositories t5601: add missing && cascade
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 65a0785..01130e5 100644
--- a/advice.c
+++ b/advice.c
@@ -73,3 +73,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);
+}