Tracing ancestry
is a very Jewish thing to do. Various genealogical lists appear in the Hebrew
Scriptures which greatly aid our understanding of certain events. Even today,
one meets Jewish people who proudly trace their family tree over many
generations. A genealogy of Jesus' descent from king David was, and still is,
an important witness to his messiahship. Most commentators agree that Matthew
[Matthew 1:1-7] gives Joseph's ancestry and Luke [Luke 3:23-38] gives Mary's.
Joseph goes back to David through the kings of Judah. This is important because, although he was not the biological father of Jesus, he was his legal guardian. Actually, if Joseph had been Jesus' father, his kingly descent would have debarred him from the messianic promises. When Judah went into captivity to Babylon (587 BCE) and the monarchy ended, God disqualified the royal line from any further role in the following way.
King Josiah had three sons and a grandson who all reigned in a complicated series of succession [2 Kings 23:31-25:30, 2 Chronicles 36]. The monarchy might have continued through any one of them. From any one of them the Messiah might reasonably have been expected to come.
As it happened, Jehoahaz died in Egypt. Jehoiakim died in prison in Babylon. After a short rule his son, Jehoiachin or Coniah, was also taken captive to Babylon. Although he was eventually pardoned, he never reigned again. Zedekiah saw his sons killed before his eyes before he, too, died in Babylon. It is from Coniah that the royal line continues down to Joseph [Matthew 1:12, 16].