How get code modifications on GitLab CI?

I have a big project with a lot of code smells. I integrated to GitLab CI some tools to static analyze code, after that I get a huge errors and issues from static analyze tools and I cant fix all of this. I decide rewrite my code step by step.

I want to check only new commits
For example I wrote some code and did command git diff. I want to get green code and pass them to
code analyze tool

My question is:
How can I get new code from GitLab CI ?
May be anyone already did this case and take me an advise ?