I have this problem with a coworker. I do work with him for months now and the problem does not seem to go away. He is a close co-worker and also kind of my mentor since I recently started as a full employee and am still learning. (I had some internships beforehand in which I also worked closely with this person.)
Since he is my mentor, he often has to explain stuff to me. Whenever I talk with him, he is kind of downgrading me. Yes, I'm not that long in this company, but he evens explains stuff to me that I know and he should know that I know it. If I accidentally mis-click, he immediately corrects me. He always tries to be right.
Example of a situation:
Just today he explained github to me. When ever I had a typo, he said something like: "Thats wrong, do it this way." or "Maybe you should learn the stuff more."
I ask him something like:
Me: Is it ok to take out this lines of code?
So I do delete the lines. Some hours or days later he says:
Why is there code missing? It's important, you can't just delete code.
If I remember right, you told me it is ok to delete it.
He turns quiet and some minutes later responds with something like:
You probably remember wrong, or you asked weirdly, so I did not know what you meant.
He seems to realize he did wrong, but searches for a way I did wrong. I also see this behavior of him against others. I often try to have their backs, but he just put me down too if I do so.
Why it bothers me so much / what I want:
I'm new in this company. The way he behaves turns a bad light on me and my skills in front of coworkers and my boss. I don't have that much of courage and I'm often scared of what people think about me. So sometimes, the whole work day I'm trying to fix what he said about me when others could hear it. I don't want others to think about me as an idiot for getting nothing done.