Qays bin Ubad (may Allah have mercy on him) narrates: I said to Sayyiduna Ali (may Allah be pleased with him): "What about this march of yours (to battle)? Is it a covenant that the Messenger of Allah (peace and blessings be upon him) specifically made with you, or merely an opinion that you have formed?" He asked: "What do you intend by this question?" I said: "It is a matter of our religion, a matter of our religion (so we seek certainty)." He said: "The Messenger of Allah (peace and blessings be upon him) did not give me any specific command or covenant about this matter; rather, it is an opinion that I formed myself."
Imam Abu Dawud (may Allah have mercy on him) narrated it through Abu Ma'mar from Isma'il.
Related hadith on this topic