Praise be to Allah.
It is well known that many shar‘i rulings were introduced in stages, paying attention to people’s circumstances at the time of the revelation. So something may have been mustahabb at the beginning, then it became obligatory, or it may have been permitted then it was forbidden, or vice versa.
What matters is the ultimate ruling.
In Saheeh al-Bukhaari (989) it was narrated that Shihaab az-Zuhri said: What is to be adopted is the latest action of the Prophet (blessings and peace of Allah be upon him).
And Muslim (1113) narrated it from him as follows: The Companions of the Messenger of Allah (blessings and peace of Allah be upon him) used to follow the latest instructions.
According to another version: They used to follow the latest command, regarding it as abrogating others and as being the one to be followed.
This that was stated by az-Zuhri is what was followed by the majority of scholars: so the later of two shar‘i texts is what is to be followed, as the shar‘i rulings came one after another and many obligatory duties and rulings were changed at later stages.
But this principle is only to be applied when it is difficult to reconcile between shar‘i texts in any possible way. However, if it is possible to reconcile between them, then this reconciliation is to be given precedence over the other approach (which is to adopt one and reject the other).
One of the well-established guidelines among the scholars is that reconciling between two texts takes precedence over adopting one and rejecting the other (after examining the soundness of both). Or in other words: considering two reports and adopting both is better than adopting one and rejecting the other.
So adopting all texts is to be given precedence over following some and rejecting others.
Al-Haafiz ibn Rajab said: If it is possible to reconcile between them and act upon all of them, it is obligatory to do so and it is not allowed to claim that one abrogates another. This is a rule that is to be applied all the time.
End quote from Fath al-Baari, by Ibn Rajab, 5/84
Al-Haafiz Ibn Hajar sad: Reconciling is preferable to adopting one and rejecting another (after examining the soundness of both), according to the consensus of the scholars of usool.
End quote from Fath al-Baari, by Ibn Hajar, 9/474
If it is not possible to reconcile between two shar‘i texts in any acceptable way, then the later text is to be followed in that case, and is regarded as abrogating the earlier text.
If it is not known which is the earlier text and which is the later text, then the scholars have to decide which has greater credibility, and there are many ways of determining that, which the scholars have discussed in detail in the books of Usool. For more information on that please see al-Bahr al-Muheet by az-Zarkashi, 4/442, and Irshaad al-Fuhool by ash-Shawkaani, 2/264
An-Nawawi said: If two hadeeths appear to contradict one another, then there is no option but to reconcile between them or determine which is more credible. That should only be done by scholars who have knowledge of both fiqh and hadeeth and scholars of usool who have great knowledge in the field, who are able to detect subtleties of meaning and are well versed in that. Any scholar of that calibre will not find it difficult to do that, except in rare cases.
Hadeeths that appear to contradict one another are of two types:
Those that can be reconciled, in which case that is what must be done and both must be followed and acted upon. Whenever we can find a more useful interpretation of a text, then we should adopt that interpretation, and we should not decide that one abrogates the other when it is possible to reconcile between texts, because when a text is abrogated it means that one of the two hadeeths is being dismissed and is no longer being followed.
Those that contradict one another in such a way that it is not possible by any means to reconcile between them. If we know that one of them abrogates the other, then we must give it precedence. Otherwise we should strive hard to work out which of the two is more credible, such as by examining the number and calibre of narrators and all other means of determining credibility, of which there are nearly 50 ways that were compiled by al-Haafiz Abu Bakr al-Haazimi at the beginning of his book an-Naasikh wal-Mansookh.
End quote from Sharh an-Nawawi ‘ala Muslim, 1/35.
To sum up:
If two shar‘i texts contradict one another, the first thing we must do is try to reconcile between them in an acceptable manner. If that is not possible then we should follow the later of the two texts. If it is not known which is the later one, we should examine them to find out which report is more credible and adopt it.
It is essential to note that the methodology of the fuqaha’ in reconciling between shar‘i texts may differ in application from one faqeeh to another. Some of them may find a way to reconcile the texts, whilst others may think that reconciling between two hadeeths is farfetched, so they may decide that one abrogates the other or they may examine them in order to determine which is more credible, and so on.
And Allah knows best.