Sahih Muslim Book 20, Hadith Number 4586.

Chapter : It is good on the part of a leader to take the oath of allegiance from his forces when intending to fight, and an account of the allegiance of God’s pleasure under the tree.

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 Holy Prophet (may peace be upon him) 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.