Praise be to Allah.
What the Muslim should do is refrain from bearing any hatred or resentment in his heart towards his fellow Muslim. Allaah says of His believing slaves (interpretation of the meaning):
“And those who came after them say: Our Lord! Forgive us and our brethren who have preceded us in Faith, and put not in our hearts any hatred against those who have believed. Our Lord! You are indeed full of kindness, Most Merciful”
According to a hadeeth narrated by Anas ibn Maalik (may Allaah be pleased with him), the Prophet (peace and blessings of Allaah be upon him) said: “Do not hate one another, do not envy one another, do not turn your backs on one another, and be, O slaves of Allaah, brothers. It is not permissible for a Muslim to forsake his brother for more than three days.” Narrated by al-Bukhaari, 5718; Muslim, 2559.
Ibn ‘Abd al-Barr said: His saying “Do not hate one another” is a prohibition which is aimed at encouraging them to discipline themselves to love one another. Al-Istidhkaar, 8/289.
But a person may feel that he does not like a person enough for him to become a close friend, even though he fulfils his Islamic duty of returning his salaams, saying “Yarhamuk-Allaah (May Allaah have mercy on you)” if he sneezes, helping him if he needs help, and so on. In this case what exists between them does not come under the heading of forsaking or shunning, and it is forgiven in sha Allaah. According to a hadeeth narrated by ‘Aa’ishah (may Allaah be pleased with her), the Prophet (peace and blessings of Allaah be upon him) said: “Souls are troops collected together and those who got along with one other (in the realm where souls existed before entering physical bodies in this world) will have an affinity with one another (in this world) andthose amongst who did not get along with one another (in the realm where souls existed before entering physical bodies in this world) will also not get along (in this world).” Narrated by al-Bukhaari, 3158; Muslim, 2638.
Al-Khattaabi said: This may be understood as referring to similarlity between souls which are either good or bad, righteous or immoral, and that good people are attracted to those who are like them and evil people are likewise attracted to those who are like them, so people’s souls recognize one another according to their nature, whether good or evil; if they are similar they will get along and if they are different they will not get along.
Al-Qurtubi said: Although souls have in common the fact that they are all souls, they differ in other ways. Souls of similar nature will get along because of their nature. Therefore we see people of a certain type get along, but they do not get along with people of a different nature, and we see that with people who are of a similar nature, some of them get along with one another and some do not, and that depends on the issues which form the basis of getting along or otherwise.