It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) sent Khalid bin al-Walid and Ali bin Abi Talib (may Allah be pleased with them both) to Yemen. He appointed Ali (may Allah be pleased with him) as commander over the Muhajirun and Khalid (may Allah be pleased with him) as commander over the Bedouin tribes, and he said: "If there is fighting, Ali will be in command of all the people."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12057