The Holy Prophet was the son to Abdullah who was the son of Abdul Muttalib. Abdullah and Abu Talib were real brothers. Abu Talib was thus the real paternal uncle of the Holy Prophet of Islam. Ali was the first cousin of the Holy Prophet. The Holy Prophet and Ali had a common grandfather Abdul Muttalib.
Abdul Muttalib was the son of Hashim who was the son of Abd Manaf who was the son of Qussay who was the son of Murrah, who was the son of Kaab, who was the son of Luayy, who was the son of Ghalib, who was the son of Fihr, who was the son of Malik who was the son of Nadr, who was the son of Kananah. Beyond Kananah the ancestry extended to Ismail, and Ibrahim, who flourished some 2500 years earlier.
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari