Skip to content

Commit 0faf247

Browse files
committed
Merge branch 'jc/advice-about-to-lose-commit'
* jc/advice-about-to-lose-commit: checkout: make advice when reattaching the HEAD less loud Conflicts: builtin/checkout.c
2 parents dbae1a1 + f807b3d commit 0faf247

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

builtin/checkout.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,24 +657,25 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
657657
"Warning: you are leaving %d commit behind, "
658658
"not connected to\n"
659659
"any of your branches:\n\n"
660-
"%s\n"
661-
"If you want to keep it by creating a new branch, "
662-
"this may be a good time\nto do so with:\n\n"
663-
" git branch new_branch_name %s\n\n",
660+
"%s\n",
664661
/* The plural version */
665662
"Warning: you are leaving %d commits behind, "
666663
"not connected to\n"
667664
"any of your branches:\n\n"
668-
"%s\n"
669-
"If you want to keep them by creating a new branch, "
670-
"this may be a good time\nto do so with:\n\n"
671-
" git branch new_branch_name %s\n\n",
665+
"%s\n",
672666
/* Give ngettext() the count */
673667
lost),
674668
lost,
675-
sb.buf,
676-
sha1_to_hex(commit->object.sha1));
669+
sb.buf);
677670
strbuf_release(&sb);
671+
672+
if (advice_detached_head)
673+
fprintf(stderr,
674+
_(
675+
"If you want to keep them by creating a new branch, "
676+
"this may be a good time\nto do so with:\n\n"
677+
" git branch new_branch_name %s\n\n"),
678+
sha1_to_hex(commit->object.sha1));
678679
}
679680

680681
/*

0 commit comments

Comments
 (0)