reset head to working commit, and implemented mean