كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(59)
Chapter: The Sariya of the Ansar
(59)
بَابُ سَرِيَّةُ عَبْدِ اللَّهِ بْنِ حُذَافَةَ السَّهْمِيِّ وَعَلْقَمَةَ بْنِ مُجَزِّزٍ الْمُدْلِجِيِّ
Sahih al-Bukhari 4340

Narrated `Ali:

The Prophet (ﷺ) sent a Sariya under the command of a man from the Ansar and ordered the soldiers to obey him. He (i.e. the commander) became angry and said "Didn't the Prophet (ﷺ) order you to obey me!" They replied, "Yes." He said, "Collect fire-wood for me." So they collected it. He said, "Make a fire." When they made it, he said, "Enter it (i.e. the fire)." So they intended to do that and started holding each other and saying, "We run towards (i.e. take refuge with) the Prophet (ﷺ) from the fire." They kept on saying that till the fire was extinguished and the anger of the commander abated. When that news reached the Prophet (ﷺ) he said, "If they had entered it (i.e. the fire), they would not have come out of it till the Day of Resurrection. Obedience (to somebody) is required when he enjoins what is good."

حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا عَبْدُ الْوَاحِدِ، حَدَّثَنَا الأَعْمَشُ، قَالَ حَدَّثَنِي سَعْدُ بْنُ عُبَيْدَةَ، عَنْ أَبِي عَبْدِ الرَّحْمَنِ، عَنْ عَلِيٍّ ـ رضى الله عنه ـ قَالَ بَعَثَ النَّبِيُّ صلى الله عليه وسلم سَرِيَّةً فَاسْتَعْمَلَ رَجُلاً مِنَ الأَنْصَارِ، وَأَمَرَهُمْ أَنْ يُطِيعُوهُ، فَغَضِبَ فَقَالَ أَلَيْسَ أَمَرَكُمُ النَّبِيُّ صلى الله عليه وسلم أَنْ تُطِيعُونِي‏.‏ قَالُوا بَلَى‏.‏ قَالَ فَاجْمَعُوا لِي حَطَبًا‏.‏ فَجَمَعُوا، فَقَالَ أَوْقِدُوا نَارًا‏.‏ فَأَوْقَدُوهَا، فَقَالَ ادْخُلُوهَا‏.‏ فَهَمُّوا، وَجَعَلَ بَعْضُهُمْ يُمْسِكُ بَعْضًا، وَيَقُولُونَ فَرَرْنَا إِلَى النَّبِيِّ صلى الله عليه وسلم مِنَ النَّارِ‏.‏ فَمَا زَالُوا حَتَّى خَمَدَتِ النَّارُ، فَسَكَنَ غَضَبُهُ، فَبَلَغَ النَّبِيَّ صلى الله عليه وسلم فَقَالَ ‏ "‏ لَوْ دَخَلُوهَا مَا خَرَجُوا مِنْهَا إِلَى يَوْمِ الْقِيَامَةِ، الطَّاعَةُ فِي الْمَعْرُوفِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 4340
In-book reference : Book 64, Hadith 369
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 629
  (deprecated numbering scheme)