Praise be to Allah.
Shunning a Muslim is not permissible, because the Prophet (peace and blessings of Allah be upon him) said: “It is not permissible for a Muslim to forsake his brother for more than three days, each of them turning away from the other when they meet. The better of them is the first to greet the other with salaam.”
Narrated by al-Bukhari (5727) and Muslim (2560).
An exception is made allowing shunning, as the scholars said, if it serves an interest, such as shunning the one who commits sin if it is known that shunning him is in his interests or in the interests of someone else, such as if he will give up his sin or others will not be tempted because of his example.
Shunning is ended if the greeting is given, so if one person greets another with salam, then he is no longer shunning him, because of the hadeeth (Prophetic narration) quoted above: “The better of them is the first to greet the other with salam.”
See also question no. 93888.
If a person repents from his sin, Allah accepts his repentance, as He says (interpretation of the meaning):
“And He it is Who accepts repentance from His slaves, and forgives sins, and He knows what you do.”
“Know they not that Allah accepts repentance from His slaves and takes the Sadaqat (alms, charity), and that Allah Alone is the One Who forgives and accepts repentance, Most Merciful?”
Repentance is valid at all times, except when the death rattle reaches the throat and when the sun rises from its place of setting, because of the report narrated by al-Tirmidhi (3537) and Ibn Majah (4253) from Ibn ‘Umar (may Allah be pleased with him), that the Prophet (peace and blessings of Allah be upon him) said: “Allah accepts the repentance of His slave so long as the death rattle has not yet reached his throat.”
Al-Nawawi (may Allah have mercy on him) said in Sharh Muslim: The scholars (may Allah be pleased with them) are unanimously agreed that repentance is accepted so long as the death rattle has not yet reached the throat, as it says in the hadeeth. There are three pillars or essential parts of repentance: giving up the sin, regretting what one has done and resolving not to go back to it. If he repents from a sin then goes back to it, his repentance is not invalidated. If he repents from one sin when he is committing another, his repentance is still valid. This is the view of the people of truth, whereas the Mu’tazilah (a deviant sect) differed concerning these two issues.
Muslim (2703) narrated that Abu Hurayrah (may Allah be pleased with him) said: the Messenger of Allah (peace and blessings of Allah be upon him) said: “Whoever repents before the sun rises from its place of setting, Allah will accept his repentance.”
With regard to what it says in the hadeeth of Abu Hurayrah (may Allah be pleased with him), that the Messenger of Allah (peace and blessings of Allah be upon him) said: “The gates of Paradise are opened on Mondays and Thursdays, and every slave who does not associate anything with Allah is forgiven, except a man between whom and his brother is some grudge. It is said: Wait for these two until they reconcile, wait for these two until they reconcile, wait for these two until they reconcile”, it seems that this is speaking of Allah’s forgiveness that He bestows on His slaves by His grace, without any repentance on their part.
It does not mean that the repentance of disputing parties from other sins is not accepted. If a person has a dispute with his brother, but he repents to Allah from some other sin, such as lying, for example, then Allah will accept his repentance, as is indicated by the texts.
From the words of al-Nawawi (may Allah have mercy on him) quoted above, it is clear that if a person repents from one sin when committing another, his repentance is valid according to Ahl al-Sunnah.
And Allah knows best.