I'm a big fan of Bruce Waltke's commentary on Genesis. He does a great job at holding together two tasks that are vital. It's easy to lose one whilst trying to do the other. He both pays attention to the narrative craft of Genesis, and at the same time tracks the overall storyline of Genesis and what the book as a whole is communicating.
His introduction to Genesis 37:2-50:26 is a brilliant example of this, showing what the writer is wanting to communicate through these much-loved and vivid chapters.
“The account of Jacob's line brings the book of Genesis to its climactic conclusion. The motifs of God's promises to Abraham to multiply his offspring, give them the land of Canaan, and bless the earth through them (Genesis 12:1-3) and God's covenant with Abraham and Sarah to bring forth kings from them (Genesis 17:6, 16) escalate significantly in this account. It begins with twelve sons and concludes with seventy (a number of perfection and a microcosm of the nations; see Genesis 10) travelling to Egypt, where they become a nation. Even as they travel away, they land remains important to this covenant family. Jacob, though embalmed in Egypt, is buried in the Promised Land (Genesis 50:4-14), and Joseph provides for the future exodus of his bones along with the covenant people to that land. In his benediction on his sons, Jacob prophesies that Judah will rule his brothers and nations (see Genesis 10; Genesis 46:8-27). Joseph's rule over Egypt saves the world, authenticates the prophecy, and foreshadows that dominion.
“Book 10 of Genesis [his title for Genesis 37:2-50:26] primarily pertains to the transformation of Jacob's sons under Providence. More than a so-called 'Joseph Story' — though it opens the curtain on Joseph as a teenager and closes it upon his death — this account concerns God's covenant dealings with the patriarchs and the establishment of his plans for the children of Israel. He keeps covenant by transforming all of Jacob's children, particularly Judah, to make them his worthy covenant partners. God uses Joseph to save the Israelites both physically, by giving them food, and spiritually, by separating them from the Canaanites and teaching them to love one another. Though the family's peace is shattered by their folly and rivalry, behind the scene God is working out their restoration (Genesis 45:5-7), as foreshadowed by revelatory dreams and Israel's sojourn in Egypt (see Genesis 15:3; Psalm 105:23).
“God's providence directs the covenant family's life. His providence is asserted in Joseph's double dream predicting his rule over the family. However, within this obvious theological frame, the story unfolds from a secular point of view (i.e., without angelic or other miraculous interventions). Instead, in retrospect everything happens at just the right time. Joseph providentially wastes time wandering around Shechem looking for his brothers when he happens to meet a man who had happened to overhear the brothers say where they would go. Without Joseph's delay, the Ishmaelite merchants would not have happened to come along at the right time. On the spur of the moment, it occurs to Judah to sell Joseph, so Joseph happens to end up in Egypt. The favouritism of a father, sibling rivalry culminating in selling the favourite into Egypt as a slave — 'the crime of the century' [quoting Robert Longacre] — and the cover-up all play a part in God's providence to save his elect! The narrative rejects humanism that believes in a God who 'has no hands but ours to do the work'. As Brueggeman asserts, 'The narrative works its subtle way between a primitivism which believes too easily and a humanism which is embarrassed about faith.' Joseph summarises the account's subtheme of God's providence in his famous insight: 'You intended to harm me, but God intended it for good to accomplish what is now being done, the saving of many lives' (Genesis 50:20).
“This account also addresses the question of who among the twelve sons will have the right of firstborn. The obvious son to inherit this right is Reuben, the actual firstborn, but Reuben's foolish attempt to usurp Jacob's leadership by sleeping with his father's concubine backfires (compare 2 Samuel 3:7-11; 2 Samuel 16:21-22; 1 Kings 2:13-22), and he falls from Jacob's favour (Genesis 35:22; Genesis 49:3-4). Simeon and Levi, the next two sons in line, disqualify themselves by their rash overreaction to the rape of Dinah (Genesis 34; Genesis 49:5-7). The next in line is Judah, who emerges as the leader of the family and wins the right to rule his brothers (Genesis 49:8-12). The providential birth of Judah's twin sons, Zerah and Perez, confirms this choice. Zerah puts his hand out first and a red thread is tied around his wrist, but to everyone's surprise Perez comes out first. Likewise, Jacob had unnaturally assumed the position of firstborn over his twin brother Edom (i.e., 'Red'). This preternatural similarity between the births of Judah's father and of his sons functions within the account as a sign that God once again chooses the younger song to rule over the other.
“The narrative also develops the theme that God blesses those who bless Abraham and his seed, as seen in the divine blessings on Potiphar, who promotes Joseph (Genesis 39:3), and on Pharaoh, who extends hospitality to Joseph's family.” (Pages 491-493)