First of all, there is an innate kindness in Pip that is demonstrated in the exposition of "Great Expectations" when he is kind to the grey convict on the marshes even while he is terrified of the man. For instance, Pip narrates,
Pitying his desolation, and watching him as he gradually settled down upon the pie, I made bold to say, 'I am glad you enjoy it.'
Again, when Magwitch returns to London to find the one person who has shown him kindness and tell him that he has repaid this kindness by becoming his benefactor, Pip recovers from his initial "abhorrence and repugnance" and realizes that
the wretched man, after loading me with his wretched gold and silver chains for years, had risked his life to come to me, and I held it there in my keeping!
Later that night as Pip reflects upon the change in his "great expectations," he realizes, too, that he has "deserted Joe." In a subsequent chapter Pip sees his "repugnance toward the man who had done soo much for me" reflected in the face of Herbert. Herbert, however, advises Pip, "That would be his reckless course if you forsook him," telling Pip that his obligation is to get Provis safely out of London. So, Pip begins to feel a sense of obligation, a sense awakened when he has contemplated the injustice that he has done to his loyal friend Joe.
After Magwitch relates to Pip his life story, Pip feels abhorrence when the old convict looks at him "with affection," yet at the same time, his inner nature comes through again as he "felt great pity for him." Finally, after Magwitch goes under the keel of the steamer in the attempt to get him out of London, Pip takes his
place by Magwitch's side. I felt that that was my place henceforth while he lived.
Having rekindled his sense of loyalty and obligation in his reflections upon past actions regarding Joe, Pip now states,
For now my repugnance to him had all melted away, and in the hunted, wounded, shackled creature who held my hand in his, I only saw a man who had mean to be my benefactor, and who had felt affectionately, gratefully, and generously toward me with great constancy throu a series of years. I only saw in him a much better man than I had been to Joe.