If you really want the last branch/tag checked out in detached HEAD state as well.
git reflog HEAD | grep 'checkout:' | head -1 | rev | cut -d' ' -f1 | rev
Update This is nicer if you have and aren't scared of awk.
git reflog HEAD | grep 'checkout:' | head -1 | awk '{print $NF}'