From: Nicolas Pitre Date: Fri, 26 Jan 2007 22:26:08 +0000 (-0500) Subject: add reflog entries for HEAD when detached X-Git-Tag: v1.5.0-rc4~49^2~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e1dde3d06c7caa242dd4b419aebb9a9b7fee2d48;p=git.git add reflog entries for HEAD when detached Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- diff --git a/git-checkout.sh b/git-checkout.sh index 8500f51ea..ac378cdb1 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -259,8 +259,9 @@ if [ "$?" -eq 0 ]; then # git update-ref --detach HEAD $new # or something like that... # - echo "$detached" >"$GIT_DIR/HEAD.new" && - mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" || + git-rev-parse HEAD >"$GIT_DIR/HEAD.new" && + mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" && + git-update-ref -m "checkout: moving to $arg" HEAD "$detached" || die "Cannot detach HEAD" if test -n "$detach_warn" then