The evolution of galaxy mass in hierarchical models