Having said all that He had to, at the end of the Bhagavad Gita, Lord Krishna tells Arjuna, 'Sarva-dharman parityajya mam ekam sharanam vraja, Aham tvam sarva-papebhyo mokshayishyami ma shucah' (V 18.66).
Drop your religion or any other belief you have, and take total surrender in me. O Arjuna. I shall liberate you of all your sins and sufferings.
Religion is like soap. But just because you have washed you clothes with an expensive soap worth 100 Rupees, you will not say that ‘Oh, I am going to keep the soap on my clothes because it is such an expensive soap’. You have to wash it off.
There comes a stage when one moves above such attachments and entanglements in life (here referring to religion), and becomes Sharanagat - surrendering totally to the Lord, with this deep feeling of devotion that 'O Lord! I am yours and yours alone'. This is what has been explained in this verse.
Lord Krishna had to say this to Arjuna, otherwise, no matter what knowledge He gave to Arjuna, he would just get stuck with it and not let go.
If Lord Krishna would advise Arjuna by saying, ‘Do it this way’, then he would simply follow and do only that much. So that Arjuna does not get stuck, in the end, Lord Krishna said to him, ‘Drop every religion or belief and simply come take refuge in Me. You cannot liberate yourself from your sins. I shall free you from all your sins and sufferings, so simply come to Me’.
Suppose you commit a wrong deed and you go on repenting saying, ‘Oh! I have committed such a wrong deed. How can I be free from it? What do I do?’ You cannot liberate yourself from your sins by making efforts. This is why Lord Krishna says, ‘I am ready to bear all your sins and sufferings, so just drop everything and come and take refuge in Me’.