Hadithcore
Sahih Muslim, 1858 a
sahih

It has been narrated on the authority of Ma'qil b. Yasar who aaid:

I remember being present on the Day of the Tree, and the Prophet (ﷺ) was taking the oath of the people and I was holding a twig of the tree over his head. We were fourteen hundred (in number). We did not take oath to the death, but to the effect that we would not run away from the battlefield.

وَحَدَّثَنَا يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا يَزِيدُ بْنُ زُرَيْعٍ، عَنْ خَالِدٍ، عَنِ الْحَكَمِ بْنِ عَبْدِ اللَّهِ، بْنِ الأَعْرَجِ عَنْ مَعْقِلِ بْنِ يَسَارٍ، قَالَ لَقَدْ رَأَيْتُنِي يَوْمَ الشَّجَرَةِ وَالنَّبِيُّ صلى الله عليه وسلم يُبَايِعُ النَّاسَ وَأَنَا رَافِعٌ غُصْنًا مِنْ أَغْصَانِهَا عَنْ رَأْسِهِ وَنَحْنُ أَرْبَعَ عَشْرَةَ مِائَةً قَالَ لَمْ نُبَايِعْهُ عَلَى الْمَوْتِ وَلَكِنْ بَايَعْنَاهُ عَلَى أَنْ لاَ نَفِرَّ ‏.‏

References2 variants
In-Book Reference
Book 33, Hadith 114
USC-MSA web (English) reference
Book 20, Hadith 4586 (deprecated numbering scheme)