He who has to take an oath, he must not take oath but by Allah. The Quraish used to take oath by their fathers. So he (the Holy Prophet) said: Do not take oath by your fathers. (Using translation from Muslim 1646f)
عَنِ النَّبِيِّ ﷺ قَالَ مَنْ كَانَ حَالِفًا فَلَا يَحْلِفْ إِلَّا بِاللهِ وَكَانَتْ قُرَيْشٌ تَحْلِفُ بِآبَائِهَا قَالَ فَلَا تَحْلِفُوا بِآبَائِكُمْ