Abdullah bin Umar reported,

The Messenger of Allah ﷺ prayed one rakah with one of the two groups while the other group faced the enemy. Then they withdrew and took the position of their companions, and the others came forward and he prayed one rakah with them. He then gave the salam, after which the first group stood and completed their remaining rakah, and the second group stood and completed their remaining rakah.

Bukhari 4133

Sahih

حدثنا مسدد حدثنا يزيد بن زريع حدثنا معمر عن الزهري

عن سالم بن عبد الله بن عمر عن أبيه

أن رسول الله ﷺ صلى بإحدى الطائفتين والطائفة الأخرى مواجهة العدو ثم انصرفوا فقاموا في مقام أصحابهم أولئك فجاء أولئك فصلى بهم ركعة ثم سلم عليهم ثم قام هؤلاء فقضوا ركعتهم وقام هؤلاء فقضوا ركعتهم

البخاري 4133صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Expeditions
Chapter
Expedition of Dhat al-Riqa
Numbering
Darussalam 4133
Bukhari 4133