Sort HEAD ref at the top of the list, not the bottom Change-Id: I37231767c19f72fbc681cd41367e0d832fd54252