Praise be to Allah.
The more correct of the two scholarly opinions is that if the apostate repents to Allaah and enters Islam again, repenting and turning to Allaah, he does not have to repeat the actions that he did before he apostatized, because Allaah has stipulated for deeds to be rendered worthless by apostasy that the person should die in that state. Allaah says (interpretation of the meaning): “And whosoever of you turns back from his religion and dies as a disbeliever, then his deeds will be lost in this life and in the Hereafter, and they will be the dwellers of the Fire. They will abide therein forever” [al-Baqarah 2:217]. So in order for deeds to be lost, it is stipulated that the person should persist in his apostasy until death.
The verse also indicates that if he repents before death, then the deeds that he did before he apostatized will be valid, and will be acceptable in sha Allaah.