He declares her more righteous than himself (which isn’t saying much) – notice he doesn’t say “We should both die!” Suddenly him being guilty removes her death sentence???
Tamar has twins: Zerah and Perez (who sneaks out first) – Perez winds up in the lineage of Jesus. God can and does use all things!
Meanwhile back in Egypt…
Joseph is serving Potiphar and is faithful, successful and handsome… whu? Well, that works against him. Ms. Potiphar wants some Joseph. She uses his clothes to lie against him (re: tunic and his brothers) and Potiphar throws him in jail.
He’s faithful there too and eventually interprets the cupbearer and baker’s dreams.
Two years later…
Pharaoh has a dream and the cupbearer finally remembers Joseph. Pharaoh sends for Joseph and they “hurriedly” clean him and bring Joseph to Pharaoh. He interprets the dream and moves right into giving Pharaoh advice (bold). Tmrw we’ll see what Pharaoh does.
But we know Joseph is put in charge of the whole country. No one except Pharaoh is more important or powerful.
How did Joseph get there? He was faithful, honest, obedient, trustworthy, caring, honorable, godly, patient and good. Wherever he was, God was with him and those around him saw it. Eventually (years), when the time was right, he went from the jail to Pharaoh to head of the country w/in hours.
I’m not saying it’s a formula and that it will happen to anyone, but we can see a bit into how God operates here. And notice, it took a loooong time.