author | Junio C Hamano <gitster@pobox.com> | |
Sat, 19 Feb 2011 00:04:47 +0000 (16:04 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 24 Feb 2011 01:24:59 +0000 (17:24 -0800) | ||
commit | 8e2dc6ac06ae90a00965e5c00aa4918dfd447639 | |
tree | 4416c20e19236c490a23045098dfa015163ab4d1 | tree | snapshot |
parent | 7ed863a85a6ce2c4ac4476848310b8f917ab41f9 | commit | diff |
commit: give final warning when reattaching HEAD to leave commits behind
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>
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>
builtin/checkout.c | diff | blob | history |