Code

commit: give final warning when reattaching HEAD to leave commits behind
authorJunio C Hamano <gitster@pobox.com>
Sat, 19 Feb 2011 00:04:47 +0000 (16:04 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Feb 2011 01:24:59 +0000 (17:24 -0800)
You can detach the HEAD at an arbitrary commit in order to browse the
files in various points in the history or build older versions of the
software, without recording any new commit, and come back to an existing
branch.  When used in this "sightseer" mode, detached HEAD is a perfectly
safe mechanism.  It also is a useful state to experiment with throw-away
commits.

When coming back to an existing branch with "git checkout master",
however, the commits that were created on the detached HEAD will become
unreachable from anywhere but the reflog of the HEAD.  Check if the commit
we are about to leave is connected to some ref, and give a final warning
otherwise to remind the user for safety.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

No differences found