We did not pledge allegiance to the Messenger of Allah ﷺ on death. Rather, we pledged to him that we would not flee.
حدثنا أحمد بن منيع حدثنا سفيان بن عيينة عن أبي الزبير
لم نبايع رسول الله ﷺ على الموت إنما بايعناه على أن لا نفر
Muslim also narrated it, in the Book of Leadership, chapter on the desirability of the army pledging allegiance to the leader when intending to fight, etc., no. 68/1856, from the hadith of Sufyan bin Uyayna, with the same wording.