move tags and detached head to the end