The Clean Ancestors of the Messenger of God
God Almighty created the father of mankind, Adam (PBUH).
When Adam raised his head, he saw that some name was written with an enormous Nur (heavenly light) at the Great Throne: “Ahmad.”
He asked wondering: “O my Lord, what is that light?”
God Almighty replied: “It is the light of a prophet who is going to come from your offspring. His name is Ahmad up in the heaven and Muhammad on earth. If it hadn’t been for him, I wouldn’t have created you as well!” 
The enormous truth that we faithfully adhere was also proclaimed by the owner of the light after billions of years.
One day, one of the Companions, Abdullah bin Jabir (may God be pleased with him) asked, “Oh God’s Messenger, will you explain what God created before everything else”?
Before everything, He created your Messenger’s noor (light) from His own light. The light would travel with God’s power and as it wished. At that time, there was no lawh mahfuz (preserved tablet), no pen, no Heaven, no Hell, no angel, no sky, no land, no sun, no moon, no person, and no jinn. 
Firstly, the Light that enlightened the heavens with all its grandeur secondly shone in the forehead of Adam (PBUH). Then, from one prophet to another, It came to Abraham (PBUH) and through him to his son Ismael (PBUH).
Hazrat Ibrahim (Abraham), who is known as “the Father of the Prophets”, had two sons: Ishaq (Isaac) and Ismail (Ishmael). He knew, as a result of the inspiration from God Almighty, that many prophets would emerge among the descendants of Ishaq. However, it was not known whether prophets would emerge among the descendants of Ismail, who was born of Hagar.
Nevertheless, he knew that a great prophet was going to be sent at the end of time. Therefore, he desired the last Prophet to emerge among the descendants of Ismail, whom he loved very much.
The Kaba, which was first built by Adam (PBUH), was heavily damaged in the long course of time and was almost demolished. The prophet Abraham (PBUH) received an order from God Almighty to rebuild this holy structure and immediately set to work with his son Ismael.
Having completed to build Kaba, they opened their hands in supplication to God Almighty and prayed:
Our Lord! Send a Messenger from our progeny to the Muslim Ummah so that he can read to them your ayahs (verses), teach them your books and their laws, and cleanse them from their sins! 
Thus, God Almighty did not leave this sincere supplication unanswered and sent a descendant of Ismael, the prophet Muhammad (pbuh), the chief of the prophets to the world. The Master of the universe (pbuh) proclaimed this truth as, “I am the supplication of my forefather Abraham (pbuh).” 
Hazrat Ismail’s children and grandchildren continuously increased and they spread all over the Arabian Peninsula. From them, the sons of Adnan, and from them the sons of Mudar, and from them the tribe of Quraysh became superior and different from the others. The Hashim branch of the Quraysh tribe found the most honor and reputation them all.
He himself described this reality as follows:
God chose Ismail from Ibrahim’s sons, the sons of Kinana from the sons of Ismail, Quraysh from the sons of Kinana, Bani Hashim from the Quraysh, and me from the Bani Hashim. 
As every source agrees on, the master of the Universe’s (Muhammad) line of descent tracing to his 20th grandfather is as follows:
Muhammad (pbuh), Abdullah, Abdulmuttalib (his real name is Shaiba), Hashim, Abd Munaf (Mugheera), Qusai, Kilab, Murra, Kaab, Luay, Ghalib, Fahr (Quraysh), Malik, Nadr, Khuzaima, Mudrikah (Amir), Ilyas, Mudar, Nizar, Maad, Adnan. 
These are the grandfathers of our Honorary Master of the Universe. Their descendants proliferated; they all became the chieftains of several communities and were the grandfathers and fathers of several tribes.
Whenever one had two sons or when a tribe divided into two branches, our Beloved Prophet (SAV)’s descent would be found on the most dignified and esteemed side and during every period, every one of his grandfathers would be known by the exceptional noor (light) that shone on his face.
The line of descent after His 20th Grandfather
According to genealogists, it is unanimously agreed that Adnan, the 20th grandfather of our Holy Prophet, was from the progeny of Hazrat Ibrahim. There is a huge time span between Adnan and Prophet Ibrahim (pbuh). Some genealogists indicate that there are 40 generations in between. 
For this reason, the line of descent from Adnan, the 20th grandfather of the Messenger of God, to Hazrat Ibrahim, the second rank chain has been undetermined. Some genealogists say that the Holy Prophet’s line of descent dates back to Hazrat Ismail by seven generations, whereas others say nine generations. Naturally, this shows that many steps have been skipped.
The Line of Descent from Adnan to Hazrat Ibrahim
Some scholars list our Holy Prophet’s line of descent from Adnan to Hazrat Ibrahim as follows:
Udd (or Udad)
Nahur (or Sarih)
Ibrahim (pbuh) 
In addition, Ibn Ishaq takes the Messenger’s line of descent all the way to Adam (Peace be Upon Him).  However, we should state that other sources do not agree on this chain.
1. Qastalani, Mawahib al-Ladunniyya:1/6
2. Qastalani, Mawahib al-Ladunniyya:1/7
3. Surah al-Baqara, 129
4. Ibn Hisham, Sira: 1/175; Tabari, Tarikh: 2/128.
5. Ibn Sa’d, Tabaqat: 1/20. Muslim: 7/58
6. Ibni Hisham, Sira, 1/1-3; Ibn Sa’d, Tabaqat, 1/55-56; Balazuri, Ansabu’l-Ashraf, 1/12 vff; Tabari, Tarikh 2/172-180
7. Mawlana Shibli, Asr-ı Saadet, v. 1, p. 119.
8. Ibn Hisham, Sira: 1/2; Ibn Sa’d, Tabaqat: 1/56.
9. Ibni Hisham, Sira, 1/ 2-4