When you have sinned, what do you do with being baptized?
Luther:
When you arise from the sin and you repent, as it were you return to the power of your baptism. You go back to the promise of what once was done to you but were lost to it through sin. That promise (He that believeth and is baptized shall be saved) stays true forever and will receive us with open arms when we return. As Paul says in 2 Timothy 2: If we believe not, yet He abideth faithful: He cannot deny himself.
By that truth you have something to hold on to that the devil and your own conscience cannot change. You have something that can be a comfort in all temptations, namely this one truth, that God is faithful to His promises and that you received the sign of that in baptism. If God be for us, who can be against us?
The people Israel also did this. When they wanted to convert, they always thought back to the exodus from Egypt. By thinking back to that, they found the way back to God again, who brought them out of Egypt. Moses and David impress this remembrance upon them time after time.