There are numerous verses in the New Testament which teach that Jesus did not sin while He was on earth (Heb. 4:15; 7:26; 2 Cor. 5:21; 1 John 3:5). Peter wrote, “Who committed no sin, nor was deceit found in His mouth” (1 Pet. 2:22). How did Jesus not sin?
Note the verb tenses in verse 23, which emphasize His ongoing determination and steadfastness in the face of provocation and temptation. “When He was being reviled” (present tense, emphasizing incessant abusive language and insults), He kept on “not reviling in return” (imperfect tense denotes continuous activity in the past). “When He was suffering” (present tense, emphasizing incessant torture at the hands of lawless men), He kept on “not threatening” (imperfect tense). So, these reveal what He kept on “not” doing. What positive action did He take? “But,” He kept on “committing” (imperfect tense) “Himself to Him who judges righteously.”
How can I resist sin the way that Jesus did? Go back and read those verbs and put them into practice.