Astrocladistics: A phylogenetic analysis of galaxy evolution I. Character evolutions and galaxy histories