Musnad Ahmad 240
It was narrated that Ibn ‘Abbas said; ‘Umar said:
I was walking with a group of people during a campaign I went on with the Messenger of Allah (ﷺ) and I swore an oath, saying, No, by my father. A man behind me rebuked me for that and said: “Do not swear by your fathers,” I turned around and saw that it was the Messenger of Allah (ﷺ).
حَدَّثَنَا عَبْدُ الرَّزَّاقِ، أَنْبَأَنَا إِسْرَائِيلُ، عَنْ سِمَاكٍ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ قَالَ عُمَرُ رَضِيَ اللَّهُ عَنْهُ كُنْتُ فِي رَكْبٍ أَسِيرُ فِي غَزَاةٍ مَعَ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَحَلَفْتُ فَقُلْتُ لَا وَأَبِي فَنَهَرَنِي رَجُلٌ مِنْ خَلْفِي وَقَالَ لَا تَحْلِفُوا بِآبَائِكُمْ فَالْتَفَتُّ فَإِذَا أَنَا بِرَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ‏.‏